Skip to content

#358 Tablet keyboard shortcuts and phones always stacked - #643

Merged
ivanfenenko merged 4 commits into
mainfrom
feature/358-tablet-input-polish
Oct 11, 2026
Merged

ivanfenenko merged 4 commits into
mainfrom
feature/358-tablet-input-polish

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Hardware keyboard shortcuts on iPad and Android tablets:

    Action iPad Android Where
    Toggle sidebar ⌃⌘S Ctrl+Alt+S Home and Settings split
    Next / previous session ⌃Tab / ⌃⇧Tab Ctrl+Tab / Ctrl+Shift+Tab Home split
    Focus composer ⌘L Ctrl+L Any Session Chat with a prompt composer

    Next/previous follows the visible Home list order for the current filter. It does not wrap. With nothing selected, it picks the first or last session. The newly selected row is scrolled into view.

  • The shortcuts stay off while another text field, a sheet or a dialog has focus. They work while the composer has focus.

  • They are listed only where they apply: in the iPad View menu and hold-⌘ overlay, and in the Android Keyboard Shortcuts Helper (Meta+/) under "Sessions".

  • OpenCodeSessionComposer can be asked to take focus and reports whether it has focus, on both platforms. Its gallery entries show both. No visual change.

  • Decision on large phones in landscape: phones always use the stacked layout. The Home and Settings split now requires an iPad at regular width on iOS, or a smallest screen width of at least 600dp plus a window at least 720dp wide on Android. Before this, iPhone Plus/Max and almost every Android phone split in landscape.

  • The left-edge swipe to reopen the sidebar is not included. It conflicts with Android's system Back gesture and iOS's back-swipe, and the top-bar button and handle drag already reopen the pane.

Checks

  • Android, after merging main: :app:assembleDebug succeeded. :app:testDebugUnitTest ran 1,854 tests with 1 failure (ConnectionProbeServiceTest, which this branch does not touch; it passes 12/12 when run alone). ktlint reports only violations that already exist (soft-fail in CI).
  • iOS, after merging main: xcodebuild test -only-testing:"OpenCode MobileTests" on the iPad Pro 13-inch (M4) simulator: 1,774 tests passed.
  • Android, in the real app on a Pixel Tablet emulator, against a local opencode server with 63 sessions (before merging main):
    • Ctrl+Tab and Ctrl+Shift+Tab stepped through sessions and stopped at the first one.
    • Ctrl+L focused the composer, and stepping still worked from there.
    • Ctrl+Alt+S toggled the sidebar on Home and on Settings.
    • Meta+/ listed all four shortcuts.
    • At phone-landscape size (914×411dp) the layout was stacked: Ctrl+L worked and Ctrl+Tab did nothing.
  • iOS, in the real app: a temporary XCUITest sent key presses against a local server (test removed afterwards).
    • All four shortcuts worked, including with the composer focused.
    • Nothing fired with the Servers sheet or the Rename dialog open.
    • The menu listed only the shortcuts that apply.

Issue

Risks / Follow-ups

  • iPadOS claims ⌃Tab for keyboard focus navigation. Next/Previous are also registered as priority UIKeyCommands, so the menu lists them without the ⌃⇥ glyph.
  • On iOS, shortcuts stay listed while the web terminal or a system picker (photos, files, share) is active. Pressing one there does nothing.
  • On Android, the "another text field has focus" rule is covered by unit tests only, not checked on a device.
  • The on-device checks ran before merging main's Changes/Terminals split views (Changes and Terminals split views #359). The merge conflicted only in the split-pane layout helpers, and the shortcuts were not re-run on a device after it.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Note

Medium Risk
Touches global key dispatch, split-layout breakpoints, and focus/modal gating across Home, Settings, and chat; behavior differs by platform (e.g. iPad Ctrl+Tab priority) and was not fully re-tested on device after merge conflicts.

Overview
Adds tablet hardware keyboard shortcuts on Android and iOS with shared behavior: toggle Home/Settings sidebar, step sessions in the visible Home list (no wrap), and focus the session chat composer. Shortcuts are gated so they do not fire while a non-composer text field is focused or a modal/sheet is up; the composer still allows them.

Android introduces a window-level KeyboardShortcutHost in MainActivity (dispatchKeyEvent before Compose), KeyboardShortcutHandler registration, and an OpenCodeInputFocusRegistry wired through text inputs and bottom sheets. iOS adds scene commands, a text-focus monitor, window overlay tracking, and priority UIKeyCommands so Ctrl+Tab is not stolen by system focus navigation.

OpenCodeSessionComposer gains a programmatic focus API on both platforms (gallery demos included). The session list reports display order and scrolls keyboard-selected rows into view.

Split layout is tightened so phones stay stacked in landscape: Android requires smallest width ≥600dp plus window ≥720dp; iOS requires iPad with regular horizontal size class (replacing width-only / large-phone split).

Reviewed by Cursor Bugbot for commit 9079a3c. Bugbot is set up for automated code reviews on this repo. Configure here.

ivanfenenko and others added 2 commits October 11, 2026 14:33
Hardware keyboard shortcuts on iPad and Android tablets: toggle sidebar,
next/previous session, focus composer. They are listed in the iPad
shortcut overlay and the Android Keyboard Shortcuts Helper, and stay off
while another text field, sheet, or dialog has focus.

OpenCodeSessionComposer can be asked to take focus and reports its focus.
The Home and Settings split layout now requires a tablet; phones stay
stacked in landscape on both platforms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…put-polish

# Conflicts:
#	android/app/src/main/java/dev/opencode/mobile/ui/components/layout/OpenCodeSplitPaneLayout.kt
#	ios/OpenCode Mobile/OpenCode Mobile/Components/Layout/OpenCodeSplitPane.swift
#	ios/OpenCode Mobile/OpenCode Mobile/Components/Layout/OpenCodeSplitPaneLayout.swift
@ivanfenenko
ivanfenenko marked this pull request as ready for review October 11, 2026 12:39
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9079a3c. Configure here.

ivanfenenko and others added 2 commits October 11, 2026 14:54
Keyboard session stepping scrolled the selected row into view but left
the follow-top pin set, so a later newcomer pinned the list back to the
top and moved the selected row off-screen. After the reveal, follow the
top only if the list is still at it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…put-polish

# Conflicts:
#	android/app/src/main/java/dev/opencode/mobile/Navigation.kt
@ivanfenenko
ivanfenenko merged commit b1b93e8 into main Oct 11, 2026
@ivanfenenko
ivanfenenko deleted the feature/358-tablet-input-polish branch October 11, 2026 13:04
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.

Tablet input polish

1 participant