fix(core): resolve TUI focus ancestry in check_view_or_child_focused - #76
Merged
Conversation
`check_view_or_child_focused` walked only the GUI presenter's `parents` map (and returned false when a window had no GUI presenter). But a Zap TUI view's parentage lives in `view_parents` (populated by the TUI present pass via `report_view_embeddings`), not the GUI presenter — which only tracks GUI `views`. So when focus landed on a TUI session view (or its embedded input child), the check resolved a one-element chain and reported "not focused", even though the view or its child genuinely held focus. Route by where the focused leaf view lives, mirroring `dispatch_typed_action_to_focused` and `get_responder_chain`: a TUI leaf uses `view_ancestors` (the `view_parents` hierarchy); a GUI leaf uses the presenter (falling back to `view_ancestors` when the window has no GUI presenter). The GUI path is unchanged. Fixes `root_view::root_projects_only_the_focused_retained_session_view` and `session_registry::focus_drives_events`. warpui_core 293/0; warp_tui serial now 597/0/0 (all eight of issue #4's serial failures resolved). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gDYSHa4oDvQbfungWwG1h
This was referenced Aug 5, 2026
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.
Part of #4. Fixes the last two serial failures (the "focus pair").
Problem
check_view_or_child_focusedwalked only the GUI presenter'sparentsmap, and returnedfalsewhen a window had no GUI presenter. But a Zap TUI view's parentage lives inview_parents(populated by the TUI present pass viareport_view_embeddings), not the GUI presenter (which tracks only GUIviews). So when focus landed on a TUI session view or its embedded input child, the check resolved a one-element chain and reported "not focused".Fix
Route by where the focused leaf view lives, mirroring the existing
dispatch_typed_action_to_focused/get_responder_chainlogic:view_ancestors(theview_parentshierarchy)ancestors(falling back toview_ancestorswhen the window has no GUI presenter)The GUI path is unchanged.
Result
root_view::root_projects_only_the_focused_retained_session_viewandsession_registry::focus_drives_eventspass.warpui_core293/0;warp_tuiserial now 597/0/0 — all eight of warp_tui lib test suite: remaining failures after deadlock fix #4's serial failures resolved.No assertions weakened; the prior "presenter/TUI-view ancestry, not force-greenable" read was mistaken — the fix is the correct hierarchy lookup, not a test relaxation.
🤖 Generated with Claude Code