Skip to content

fix(core): resolve TUI focus ancestry in check_view_or_child_focused - #76

Merged
jwp2987 merged 1 commit into
mainfrom
fix/issue4-focus-pair
Aug 5, 2026
Merged

fix(core): resolve TUI focus ancestry in check_view_or_child_focused#76
jwp2987 merged 1 commit into
mainfrom
fix/issue4-focus-pair

Conversation

@jwp2987

@jwp2987 jwp2987 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Part of #4. Fixes the last two serial failures (the "focus pair").

Problem

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 tracks only 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".

Fix

Route by where the focused leaf view lives, mirroring the existing dispatch_typed_action_to_focused / get_responder_chain logic:

  • TUI leaf → view_ancestors (the view_parents hierarchy)
  • GUI leaf → presenter ancestors (falling back to view_ancestors when the window has no GUI presenter)

The GUI path is unchanged.

Result

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

`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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant