Repository navigation
Focus a question card on appear without trapping Tab - #1144
Conversation
The card sits in the chat, so Tab stays on Continue and can reach the composer. Arrow and number keys only move focus, so a fast-path option is not submitted while moving.
PR Summary by QodoImprove question card keyboard focus and navigation
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
Next and Back stay visible when the question changes, so a control with no question group cannot count as already on the new step.
No GitHub issue or Linear id — neither was opened for this change.
What & why
A question card in the desktop chat did not take the keyboard when it appeared, and a focused option had no ring of its own on this palette. The card now moves focus to the first option, or the text field when there are no options, when it shows in the chat you are looking at. Arrow keys and 1–9 move between options without selecting them; Enter or Space activates. Tab stays on the normal order and can leave the card for the composer, because the card is inline in the chat rather than a dialog.
Where to look
QuestionCardKeyboardrecords which step it already focused, so a recycled row does not take focus again, and it does not steal focus from outside that chat. Advancing a series moves focus to the next question only when focus was already inside the card.Verification
dotnet run --project test/Capacitor.App.Tests.Unit/Capacitor.App.Tests.Unit.csproj -- --treenode-filter "/*/*/ChatTabViewSmokeTests/A_question_card_takes_focus*"— passed, twice, then again after the final edit.dotnet run --project test/Capacitor.App.Tests.Unit/Capacitor.App.Tests.Unit.csproj -- --treenode-filter "/*/*/ChatTabViewSmokeTests/Advancing_a_series*"— passed (included in a 44-test run of that class's question-card filters; the one failure in that run was the focus test before a flaky assertion, and the rerun above passed).