fix(tui): release overlay focus to explicit targets

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.
This commit is contained in:
Nico Bailon
2026-05-29 23:40:27 -07:00
parent 5d9b28ee43
commit 735ccbd00f
5 changed files with 171 additions and 17 deletions

View File

@@ -116,12 +116,14 @@ handle.setHidden(true); // Temporarily hide (can show again)
handle.setHidden(false); // Show again after hiding
handle.isHidden(); // Check if temporarily hidden
handle.focus(); // Focus and bring to visual front
handle.unfocus(); // Release focus to previous target
handle.unfocus(); // Release focus to the next visible overlay or previous target
handle.unfocus({ target: baseComponent }); // Release this overlay to a specific component
handle.unfocus({ target: null }); // Release this overlay without focusing another component
handle.isFocused(); // Check if overlay has focus
// A focused visible overlay keeps keyboard input until hidden or explicitly unfocused.
// If you want a base component to receive input while the overlay remains visible,
// call handle.unfocus() before focusing the base component.
// A focused visible overlay reclaims keyboard input after temporary replacement UI
// releases focus. If you want a specific component to receive input while overlays remain
// visible, call handle.unfocus({ target: component }).
// Hide topmost overlay
tui.hideOverlay();