Repository navigation
fix(tui): let a new approval actually take focus - #414
Merged
Merged
Conversation
An approval that painted before the tick got its focus grab silently skipped, and every key on the card except Esc did nothing. `draw` calls `sync_approval_menu`, which stamps `menu.call_id`. `sync_approval_focus` used that same field to decide whether the prompt was new — so once a frame had painted, the prompt read as already seen and focus was never claimed. `handle_approval_menu_key` gates on `FocusBlock::Approval`, so arrows, Enter and the shortcut letters were all dropped, leaving a prompt on screen that looked interactive and wasn't. Give the focus grab its own `focus_claimed_for`, so what a frame does can't decide what the tick has handled. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
This was referenced Aug 21, 2026
mohitranka
added a commit
that referenced
this pull request
Aug 21, 2026
An approval that painted before the tick got its focus grab silently skipped, and every key on the card except Esc did nothing. `draw` calls `sync_approval_menu`, which stamps `menu.call_id`. `sync_approval_focus` used that same field to decide whether the prompt was new — so once a frame had painted, the prompt read as already seen and focus was never claimed. `handle_approval_menu_key` gates on `FocusBlock::Approval`, so arrows, Enter and the shortcut letters were all dropped, leaving a prompt on screen that looked interactive and wasn't. Give the focus grab its own `focus_claimed_for`, so what a frame does can't decide what the tick has handled. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
An approval that painted before the tick got its focus grab silently skipped, and every key on the card except Esc did nothing. `draw` calls `sync_approval_menu`, which stamps `menu.call_id`. `sync_approval_focus` used that same field to decide whether the prompt was new — so once a frame had painted, the prompt read as already seen and focus was never claimed. `handle_approval_menu_key` gates on `FocusBlock::Approval`, so arrows, Enter and the shortcut letters were all dropped, leaving a prompt on screen that looked interactive and wasn't. Give the focus grab its own `focus_claimed_for`, so what a frame does can't decide what the tick has handled. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
An approval that painted before the tick got its focus grab silently skipped, and every key on the card except Esc did nothing. `draw` calls `sync_approval_menu`, which stamps `menu.call_id`. `sync_approval_focus` used that same field to decide whether the prompt was new — so once a frame had painted, the prompt read as already seen and focus was never claimed. `handle_approval_menu_key` gates on `FocusBlock::Approval`, so arrows, Enter and the shortcut letters were all dropped, leaving a prompt on screen that looked interactive and wasn't. Give the focus grab its own `focus_claimed_for`, so what a frame does can't decide what the tick has handled. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
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.
An approval prompt that painted before the tick got its focus grab silently skipped, and every key on the card except Esc did nothing. The card looked interactive and wasn't.
The bug
draw()callssync_approval_menu()(app/render.rs:318), which stampsmenu.call_id.sync_approval_focus()(app/shell.rs:210) used that same field to decide whether the prompt was new — so once a frame had painted, the prompt read as already-seen and focus was never claimed.handle_approval_menu_keygates onFocusBlock::Approval, so arrows, Enter and the shortcut letters (y/a/n) were all dropped. Esc worked only because it is handled globally.The gate itself is correct and stays: Tab away to the file explorer mid-approval and arrows should move the tree, not the menu. The defect was upstream of it.
The fix
sync_approval_focustracks its ownfocus_claimed_for, so what a frame does can no longer decide what the tick has handled.This is the same class as the existing "no side effects in
draw()" rule.draw()still mutates menu state — that is load-bearing for rendering and now harmless — so this change does not touch it.Verification
approval_claims_focus_even_if_a_frame_paints_firstsimulates the real order (draw, then tick). Reverting onlyapprovals.rsmakes it fail at the focus assertion; it passes with the fix.cargo fmt --all -- --checkclean,cargo clippy --all-targetsclean,cargo test --workspacegreen across 45 test binaries.https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p