Feat/issue 5129 tui overlay focus#5235
Merged
badlogic merged 4 commits intoJun 1, 2026
Merged
Conversation
Preserve a focused visible overlay as the input owner across extension custom UI replacement, while letting the replacement receive and close its own input before focus is restored. Fixes earendil-works#5129.
Add an explicit overlay unfocus target so callers can move input to the editor or another component while overlays remain visible. Align fallback overlay focus with visual focus order and cover blocked replacement release, null targets, and multi-overlay cycling.
Update the overlay QA focus demo to exercise three visible overlays with text input, focus cycling, per-panel dismissal, and visual focus ordering.
Collaborator
|
What it does:
Good:
Bad:
Ugly:
Tests:
This comment is AI-generated. |
Collaborator
|
@nicobailon sorry for the ai review above, but it's 0:30am and i'm tired :D |
3e72873 to
91a2f86
Compare
Contributor
Author
|
Updated: removed the changelog entry, added the missing coding-agent docs, and covered the real |
Collaborator
|
cheers! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5129.
The issue was caused by focus returning to the editor while a visible overlay still expected to own input. That left the overlay rendered on screen but no longer interactive.
I fixed this in
pi-tui, where the relevant state already lives: overlay visibility, focus order,preFocus,nonCapturing, and input routing. Overlay focus restoration is now modeled as a single TUI-level state, so the overlay that actually had focus can reclaim input after temporary replacement UI closes.This covers raw
tui.showOverlay()callers too, not just extension custom UI. It also handles replacement UI keeping input while active, focus moving inside replacement UI, explicitsetFocus(null), and stalepreFocuschains when child overlays are removed before their parent closes.I also added
OverlayHandle.unfocus({ target })so callers can intentionally keep an overlay visible while releasing input to the editor or another component.Expands
/overlay-focusinto a manual QA demo for multiple visible overlays, focus cycling, text input, dismissal, rendering order, and returning focus to the built-in editor after all overlays close.demo.mp4