feat(desktop): add keyboard navigation to clarify choices - #64346
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Desktop keyboard-navigation work. The feature is still absent on current main: apps/desktop/src/components/assistant-ui/clarify-tool.tsx:308-353 supports letter shortcuts only, with Enter limited to an existing answer.
Problems
- The new unqualified Enter path at
apps/desktop/src/components/assistant-ui/clarify-tool.tsx:400-406is registered once per mounted clarify card. Current main mounts chat surfaces for the primary and every tile (apps/desktop/src/app/chat/index.tsx:428-431) and scopes each card to its own session request (clarify-tool.tsx:188-192). One body-level Enter could therefore answer multiple pending clarifications. - The new tests mount one card only (
clarify-tool.test.tsx:67-80), so this multi-session path is untested.
Suggested changes
- Gate shortcut handling to the focused clarify/session surface and add a primary-plus-tile regression test asserting only that request receives
clarify.respond. - Salvage onto current main's session-scoped clarify implementation; GitHub currently reports this PR as dirty against main.
Automated hermes-sweeper review.
| } | ||
|
|
||
| if (event.key === 'Enter' && pendingAnswer) { | ||
| if (event.key === 'Enter') { |
There was a problem hiding this comment.
On current main, clarify cards can be mounted simultaneously for the primary surface and session tiles (apps/desktop/src/app/chat/index.tsx:428-431), each with a session-scoped request. Every ready card receives this window-level Enter and can call activateActive(), so a single Enter can answer multiple requests. Gate this to the focused clarify/session surface and add a multi-card regression test.
Summary
clarifychoicesArrowUp/ArrowDownnavigation across every choice and the trailing Other field1–9, while preserving the existingA/B/CshortcutsEnterconfirm the selected answer or the currently highlighted rowMotivation
The Desktop clarify card already supports mouse input and letter shortcuts, but keyboard-heavy workflows still require users to target a specific letter or reach for the mouse. This makes the card behave like the other keyboard-oriented pickers in the app without changing the
clarify.respondprotocol or any backend behavior.Behavior
Entersubmits an existing answer; with no explicit selection it submits the highlighted choice or focuses OtherTest plan
npx vitest run src/components/assistant-ui/clarify-tool.test.tsx— 9 tests passednpm run typechecknpx eslint src/components/assistant-ui/clarify-tool.tsx src/components/assistant-ui/clarify-tool.test.tsx— 0 errorsnpx prettier --check src/components/assistant-ui/clarify-tool.tsx src/components/assistant-ui/clarify-tool.test.tsxnpm run buildScope
Desktop renderer only. No tool schema, gateway, session, profile, or backend changes.