Navigate open selections with Ctrl-N and Ctrl-P#4394
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new keyboard navigation feature (Ctrl-N/P for selection menus) with global event handling and changes across multiple UI components. New user-facing capabilities warrant human review. You can customize Macroscope's approvability policy. Learn more. |
12e607a to
bbe7273
Compare
bb487f3 to
641e30d
Compare
0b6f818 to
873c2a5
Compare
873c2a5 to
ac909b9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5eb4ad5. Configure here.
5eb4ad5 to
7a843d8
Compare

What Changed
Ctrl-N/Ctrl-Pto Down/Up while the focused control owns an open command palette, combobox, autocomplete, select, menu, listbox, or composer suggestion menu.Ctrl-Nnavigates an open picker instead of opening a new thread.Why
Prompt controls should behave consistently as keyboard-first selection surfaces. Readline-style
Ctrl-N/Ctrl-Pnavigation must take precedence over global shortcuts while a picker is open, and completing a selection should return the user directly to prompt entry.UI Changes
Interaction-only; there are no layout or styling changes.
Verified in an isolated authenticated web environment:
Ctrl-N; highlight moved from Add project to Open settings while the query stayed empty and the palette stayed open.Ctrl-P; highlight moved back to Add project.Interaction recording
The follow-up prompt-focus flow was also launched in an isolated environment. API authentication succeeded, but the collaborative preview remained on its pairing route, so that pass could not reach the prompt surface for a second recording.
Checklist
vp test run apps/web/src/selectionNavigation.test.ts apps/web/src/AppRoot.test.tsx apps/web/src/components/chat/composerProviderState.test.tsx(26 tests pass)vp check(0 errors; 11 unrelated existing warnings)vp run typecheck— existing@effect/vitestexport errors inoxlint-plugin-t3code; no errors in changed filesNote
Medium Risk
Global capture-phase key handling can interact with other shortcuts, but scope is narrow (Ctrl-only, open picker surfaces) and covered by unit tests; widespread UI callback wiring is low-risk behavior change.
Overview
Readline-style navigation while pickers are open: A new
selectionNavigationmodule maps Ctrl-N / Ctrl-P to ArrowDown / ArrowUp on the focused control when an owned menu, select, combobox, listbox, command palette, or composer suggestion surface is open. It registers at app root viaSelectionNavigationBindingsin capture phase so navigation wins over global shortcuts (e.g. new thread on Ctrl-N). Tooltip-wrapped runtime and traits triggers are linked viadata-chat-*markers; portaled composer suggestions usedata-composer-command-menu. Terminals, keybinding-capture fields, modified chords, empty suggestion menus, and unrelated pickers are excluded.Focus return after choosing: Composer and branch toolbar pickers thread an optional
onSelectionCompletecallback (wired toscheduleComposerFocusfrom chat) so closing a menu after model, traits, runtime mode, environment, or workspace selection returns focus to prompt entry. Mobile branch menus use controlledopenstate andcloseOnClickon radio items for the same flow.Reviewed by Cursor Bugbot for commit 7a843d8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Ctrl-N/Ctrl-P keyboard navigation for open selection surfaces in the composer
SelectionNavigationBindings, mounted globally inAppRoot, which interceptsCtrl+N/Ctrl+Pkeydown events and translates them toArrowDown/ArrowUpon the focused element when a selection surface (menu, select, combobox, command menu) is open.selectionNavigation.ts, which uses aria attributes,data-slotmarkers, and DOM heuristics to detect the active surface and route the synthetic key event.onSelectionCompletecallback that refocuses the composer after a selection is made.keydownlistener intercepts events before other handlers; Ctrl+N/P behavior in terminals and keybinding capture fields is explicitly excluded but other edge cases may exist.Macroscope summarized 7a843d8.