Skip to content

fix(tui): keep question menu focus after the first draw - #409

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/question-menu-focus
Aug 20, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/question-menu-focus

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Problem

ask_user_question painted the questionnaire, then immediately became unusable: ↑↓ did not move to the next option and the UI felt hung.

Questions reuse FocusBlock::Approval (same inline transcript prompt as HITL). The draw-time FocusAvailability check only treated a pending HITL approval as that block. The first frame therefore reset focus off the menu, so menu keys never routed.

Fix

Count a pending question as approval-focusable when computing layout-based focus availability, matching focus_availability() in focus.rs.

Test

drawing_a_question_keeps_menu_focus_so_arrows_move focuses a question, draws, presses Down, and asserts the selection (and › marker) moves.

cargo test --package forge-tui --lib -- app::tests::questions and cargo clippy --package forge-tui --all-targets --locked -- -D warnings are green.

ask_user_question reuses FocusBlock::Approval, but the draw-time
focus availability check only treated HITL as an approval prompt.
The first frame therefore kicked focus off the menu, so ↑↓ never
moved the selection and the questionnaire looked hung.

Treat a pending question as approval-focusable and assert arrows
still work after a draw.
@github-actions
github-actions Bot enabled auto-merge (squash) August 20, 2026 00:29
@github-actions
github-actions Bot merged commit 7413156 into main Aug 20, 2026
8 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
ask_user_question reuses FocusBlock::Approval, but the draw-time
focus availability check only treated HITL as an approval prompt.
The first frame therefore kicked focus off the menu, so ↑↓ never
moved the selection and the questionnaire looked hung.

Treat a pending question as approval-focusable and assert arrows
still work after a draw.
mohitranka added a commit that referenced this pull request Sep 11, 2026
ask_user_question reuses FocusBlock::Approval, but the draw-time
focus availability check only treated HITL as an approval prompt.
The first frame therefore kicked focus off the menu, so ↑↓ never
moved the selection and the questionnaire looked hung.

Treat a pending question as approval-focusable and assert arrows
still work after a draw.
mohitranka added a commit that referenced this pull request Sep 11, 2026
ask_user_question reuses FocusBlock::Approval, but the draw-time
focus availability check only treated HITL as an approval prompt.
The first frame therefore kicked focus off the menu, so ↑↓ never
moved the selection and the questionnaire looked hung.

Treat a pending question as approval-focusable and assert arrows
still work after a draw.
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