Repository navigation
#869 Keyboard and mouse support - #928
Conversation
26b6519 to
7d994a5
Compare
Tier 2 evidenceiPad simulator (shots 01–08 against a v2 server, 09–18 against a classic v1 server) and a tablet-size Android emulator (v2 server), driven with hardware key and mouse events. Android uses Ctrl where iPad uses ⌘. Shortcut lists
Keyboard
Mouse
|
Tier 3 evidencePointer checks on an iPad simulator (classic v1 server) and a tablet-size Android emulator (classic v1 server). The harness models accept no attachments, so drops are declined there; the accepted path was checked with a temporary change that turned drops on (reverted, marked "debug" below). Text selection and copy with a pointer
Drag and drop onto the composer
|
d8adff1 to
156a337
Compare
Hardware keyboard users on iPad, Android tablets and Chromebooks can drive
the app with standard focus navigation.
- Design-system controls take keyboard focus and draw one focus ring
(interactive token with a surface hairline), only for keyboard focus.
- Tab order and arrow groups on Home, Session Chat, Settings, sheets and
dialogs. Return or Space activates. Sheets keep Tab inside and return
focus to the control that opened them.
- Permission and question prompts arrive with nothing focused, so a stray
key cannot answer them. The first Tab enters at the first enabled
control. A "Press Tab to answer with the keyboard" hint shows while a
hardware keyboard is connected. In "Type your own answer", Return saves
and Esc leaves the field.
- With a hardware keyboard the composer sends on Return and adds a line on
Shift+Return, reading the live text. Not while the @ or / list is open
or IME text is composing. Soft keyboards are unchanged.
- Esc closes the top sheet or dialog, then leaves focus, then arms an
interrupt ("Esc again to interrupt"); a second Esc within 5 s stops the
turn, matching the TUI. On Android Esc otherwise acts as Back.
- New OpenCodeKeyboardHint component on both platforms.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shortcuts on top of the Tier 1 focus model, plus right-click and hover. Android uses Ctrl where iPad uses ⌘. - App: New Session ⌘N, Command Palette ⌘K, Choose Model ⌘⇧M, Settings ⌘, and Show <project> ⌘1–9. ⌘N replaces the iPad New Window command and creates the session in the open chat's project, also from a subagent session. - Prompts: ⌘⏎ Allow Once / Next Question / Submit Answers, ⌥⌘⏎ Always Allow, ⌘⌫ Deny / Dismiss Question. They act on the visible request with the same rules as the buttons and never repeat while held. In "Type your own answer" ⌘⌫ keeps deleting text. - Bare 1–9 picks a question option once focus is inside the prompt, never with modifiers or in a text field. - ↑ in an empty composer steps back through this session's sent prompts, ↓ forward; in a multi-line recall only from the first or last line. - Listed in the iPad menu bar and hold-⌘ overlay, and in the Android Keyboard Shortcuts Helper. - Right-click opens the long-press actions on messages, list rows and the session dock, and a Remove menu on projects. Right-click no longer presses plain controls. - Hover feedback in design-system controls, pointer only. Search sessions (⌘F) moved to #929. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Android declares the touchscreen optional, so Play can list the app on Chromebooks without one. - Android: a mouse click on message text only places or clears the text selection; right-click opens message actions. Touch is unchanged. - iOS: right-click opens message actions on assistant messages without markdown, as it already did on markdown messages. Checked with a pointer on both platforms: dropping files onto the composer (#870) and selecting and copying text in messages, code blocks and tool output wherever touch can select. Deny with a note moved to #946; the iOS declined-drop card is tracked in #951. Co-Authored-By: Claude Opus 5.5 <[email protected]>
156a337 to
d126024
Compare
|
@cursor reivew |
|
Posted a review on #928. The shared rule tables, prompt-chord gating, and evidence look solid; the problems are in state that outlives the UI and in a few pointer handlers that ignore consumption. Would not merge until these three are fixed:
Also worth fixing: Android only parks composer focus when a prompt arrives (sidebar/timeline focus stays live); Tab auto-repeat after prompt entry can walk onto Always; iOS’s 0.6s chord window drops a second Cmd+Return on a queued permission; several Android design-system pills still treat right-click as click. |
ReviewThe shared rule tables, prompt-chord gating, and evidence are in good shape. CI is green. The problems I found are in state that outlives the UI and in a few pointer handlers that ignore consumption. None of these showed up in the unit tests that only exercise the pure functions. High1. iOS: holding Esc can arm and interrupt in one press
Same on the root-VC and overlay commands. Return/Space on controls already use 2. iOS: stale
After Tab-out of the composer ( Prompt arrival (and overlay close when the opener is gone) should drop 3. Android: session-dock scope opens on right-click
.pointerInput(shownTabId, isSwitching) {
awaitEachGesture {
val down = awaitFirstDown(requireUnconsumed = false)
// ...
if (!dragged) {
latestOnOpen()Require an unconsumed primary press, or ignore Medium4. Android: “nothing focused when a prompt appears” only parks composer subtree focus
Park window focus on every new prompt id, not only when the composer subtree already has it. 5. Android: Tab/arrow auto-repeat after prompt entry walks to the next button Esc swallows 6. iOS: 0.6s chord window also rate-limits a second deliberate press
7. Android: several design-system controls still treat right-click as click
Related: 8. Right-click on a code block never offers “Copy code block” Both platforms always open text actions on secondary click, even over a fence. Touch tap on a code block still passes What’s solid
Test gaps that hid the above
I would not merge until 1–3 are fixed. 4–6 are the next keyboard-safety misses; 7–8 are the right-click contract. The rest of the PR (rule split, both-protocol events untouched, evidence) looks mergeable once those land. |
Keyboard: - iOS: a held Esc arms the interrupt once and never interrupts. UIKit cannot stop a key command repeating, so Esc and menu chords share a guard that holds a key until it goes up (or a 0.6 s pause). - iOS: a second deliberate Cmd+Return on a queued permission fires; a held one still fires once. - iOS: a Tab target handed over to a control that is gone (Tab out of the composer, a closed sheet's opener) is dropped, and a new prompt clears it, so the first Tab enters the prompt. - Android: focus is parked on every new prompt wherever it was, unless another text field is being typed in or a sheet is open. - Android: repeats of the Tab or arrow that entered a prompt are swallowed until the key goes up. Pointer: - Android: right-click no longer opens the session dock's scope picker, presses the action, review-changes, status, filter-tab, task-row or hunk-navigation controls, or selects a pinned list row. - Both: right-click on a code or diff block offers Copy code block, like a tap on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixesAddressed all eight points from the review in 7752f6a. High
Medium
Tests added
Not checked on device: these fixes are unit-tested and compiled on both platforms but have not been run on a simulator or emulator. Key-repeat timing, right-click on the dock, pinned rows and code blocks, and Tab after a sheet closes over a replaced opener still need a pass with hardware key and mouse events. |
Conflicts came from #886 moving app text to string resources while this branch added keyboard focus, right-click and new shortcuts on the same lines. Kept both: main's localised labels with the branch's focus and secondary-click modifiers. Keyboard shortcut titles now follow main's resource model on both platforms, extended to every Tier 2 shortcut: Android titles and group labels are UiText resolved for the Keyboard Shortcuts Helper; iOS titles, menu names and prompt-chord titles are LocalizedStringResource. New keys under keyboard_shortcuts.* on both platforms; the single Sessions group key is replaced by the Session, Prompt and Go groups. Co-Authored-By: Claude Opus 5.5 <[email protected]>










































































Summary
Fixes #869
Keyboard and mouse support for iPad, Android tablets and Chromebooks, one commit per tier.
Tier 1, both platforms:
@//list is open or IME text is composing. Soft keyboards are unchanged.OpenCodeKeyboardHintdesign-system component.Tier 2, both platforms (Android uses Ctrl where iPad uses ⌘):
Tier 3:
Platform differences:
Checks
testDebugUnitTest: 3,228 run, 3 failures unrelated to this change. Two expect2.5sand fail on a decimal-comma locale;SseRecoveryFaultOracleTestalso fails onmain.Risks / Follow-ups