Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes terminal live-input focus behavior on iPad when a hardware keyboard is attached (software keyboard height stays 0), preventing the focus path from blurring an already-focused hidden TextInput and thereby preserving the hardware keyboard responder on iOS.
Changes:
- Gate the “blur then refocus” workaround behind an explicit flag and enable it only on Android.
- Thread the new
reopenFocusedInputWhenKeyboardHiddenoption through the focus hook intofocusTerminalLiveInputTarget. - Add regression tests at both the primitive (
focusTerminalLiveInputTarget) and hook (useTerminalLiveInputFocus) layers.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mobile/src/terminal/use-terminal-live-input-focus.ts | Passes a new focus-behavior flag through the hook to control reopen behavior when keyboard height is zero. |
| mobile/src/terminal/use-terminal-live-input-focus.test.ts | Adds hook-level coverage ensuring iOS/iPad hardware-keyboard scenarios don’t blur an already-focused responder. |
| mobile/src/terminal/terminal-live-input.ts | Updates the focus primitive to conditionally apply the blur/refocus workaround based on the new flag. |
| mobile/src/terminal/terminal-live-input.test.ts | Adds primitive-level regression coverage for the new iPad/hardware keyboard focus behavior. |
| mobile/app/h/[hostId]/session/[worktreeId].tsx | Enables the reopen workaround only on Android by setting the new flag via Platform.OS === 'android'. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Warning Review limit reachedNext included review available in 3 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 6989c92 and 8807014087bb4565579f25cd97c28943b07ff99a. 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughTerminal live-input focus now accepts Merge Risk: ⚪ Minimal · up to This localized mobile change preserves iPad hardware-keyboard terminal focus while retaining the Android workaround; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
77309be to
8807014
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
8807014 to
c6e7d70
Compare
Readiness verdict: GO (P0: 0 · P1: 0 · P2: 1)Scope reviewed: Checklist
Why the Android-only gate does not regress iPhoneThe narrowing is safe because the guarded branch is unreachable on iOS through the app's own dismissal paths. Gates run locally (this worktree, at
|
| Gate | Result |
|---|---|
pnpm vitest run src/terminal/terminal-live-input.test.ts src/terminal/use-terminal-live-input-focus.test.ts |
2 files / 49 tests passed |
pnpm typecheck (tsc --noEmit) |
clean |
pnpm lint (oxlint) |
clean |
pnpm format:check (oxfmt, 1235 files) |
clean |
Simulator validation — and its proven limit
Ran the flow end-to-end on a booted iPad Pro 13-inch (M5) simulator (Xcode 26.1.1) against the repo's own mobile/scripts/mock-server.ts, with Simulator I/O → Keyboard → Connect Hardware Keyboard enabled to hold keyboardHeight at 0 — the iPad-with-Magic-Keyboard condition.
At this head, hardware-keyboard input works. Tapping the terminal brings up no software keyboard, and all 18 synthesized hardware keystrokes reach the host — the mock server logged the exact bytes ([SEND] terminal=term-1 text="a" + text="aaaaaaaaaaaaaaaaa" = 18 characters; the glyph is a synthetic-CGEvent artifact of driving the Simulator, the count is the signal).
Tap with hardware keyboard connected — no software keyboard, keyboardHeight === 0:
After typing on the hardware keyboard — the hidden responder captured all 18 keystrokes:
Limit (important, and the reason this is a supplement rather than the primary evidence): I also ran the negative control — temporarily forcing reopenFocusedInputWhenKeyboardHidden: true (the pre-fix behavior), confirming Metro re-bundled the changed module, and repeating the identical tap-and-type. It delivered the same 18 characters. So the iOS Simulator's synthetic hardware-keyboard mode cannot discriminate this fix: the guarded branch needs the hidden TextInput to already hold first responder while keyboardHeight === 0, and the Simulator does not keep a hardware-keyboard responder attached to the RN TextInput across taps the way a physically-attached Magic Keyboard does. The temporary edit has been reverted; the tree is clean at c6e7d702c66.
The load-bearing evidence for the fix therefore remains the author's physical iPad Pro M5 + Apple Magic Keyboard run recorded in the PR description, plus the unit coverage at both seams. The simulator run is a genuine non-regression check, not a repro of the original failure.
P2 (non-blocking)
use-terminal-live-input-focus.ts:32-40— the destructured parameter list placesreopenFocusedInputWhenKeyboardHiddenbeforeliveInputEnabled, breaking the otherwise alphabetical ordering used throughout this file. Cosmetic; lint is clean.
Residual risk (not a finding)
Automated coverage for the iPad hardware-keyboard path is inherently manual — no simulator or CI lane can reproduce the responder state that triggers the bug (demonstrated above). A regression here would only be caught by a human on real hardware.
Summary
This is a 3-line behavior change in mobile terminal focus handling, and it is ready to merge. It stops iOS from applying an Android-specific workaround: previously any terminal tap with the software keyboard absent would blur the hidden text field and schedule a re-focus, which on an iPad with an attached hardware keyboard meant keyboardHeight was permanently 0, so every tap tore down the input responder and physical keystrokes went nowhere. The workaround is now gated to Android, where it is actually needed.
Nothing release-blocking surfaced. The one thing worth knowing before you merge is a verification caveat rather than a defect: I built a full iPad simulator harness and confirmed hardware-keyboard typing works at this head, but the A/B negative control proved the simulator behaves identically with and without the fix, so it cannot stand in for the real-hardware evidence. The physical-iPad run in the PR description remains the actual proof, and the unit tests pin both branches so the gate cannot be silently flipped back.
Action required before release: none. The single P2 is a parameter-ordering nit and can be ignored or folded into any later touch of the file.
|
CI settled after the readiness review above: 47/47 required checks pass, |
|
Updated against main after the session-screen extraction. The sole call-site change now lives in use-mobile-session-terminal-runtime.ts; iOS preserves its responder and Android retains the existing blur/refocus workaround. No native capture, Chat/navigation, or transport work from #18901 is included. Final diff: 6 files, +70/-11. The extra file updates only the parity string count/hash for the added android platform literal. Local validation: 509 mobile test files passed, 4,163 tests passed / 3 skipped; mobile typecheck passed. Original focused regressions retained and passing. Fresh fork workflows approved and running. Original author-reported physical iPad/Magic Keyboard proof remains historical; no new physical typing run is claimed. |
Resolves eight conflicts from main's SSH e2e lane restructure and the mobile relay stream-cancellation fix. - e2e.yml / run-ssh-docker-e2e.mjs / pr-e2e-gate-contract.test.mjs: keep main's lane structure and re-express only the hosted-mobile-webview SSH exclusion. - reliability-gates.jsonc: main's file plus the branch's mobile-hybrid gate. - mobile-relay-rpc-streams.ts: main's cancellation machinery replaces the branch's equivalent, generalized to every server-assigned-id method. - docker-ssh-relay-connection.ts: main's delegation to connectSshTestTarget, with the branch's connect timeout moved into that shared helper. - mobile-session-route-parity.test.ts: digest re-frozen for main's #12772. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
* fix(mobile): preserve iPad terminal input focus * Keep incoming main test formatting unchanged --------- Co-authored-by: Neil <[email protected]>


ELI5
If you use Orca on an iPad with a physical keyboard attached, tapping a terminal to type could stop working: the app mistook "no on-screen keyboard" for "you dismissed the keyboard" and reset the hidden typing field, so hardware keystrokes never reached the terminal. That reset trick is now used only where it's needed (Android). On iPad, tapping a terminal keeps the typing field attached, so a physical keyboard just works.
Problem
On iPad with a hardware keyboard attached, the software keyboard height remains zero. The terminal input focus path treated that as a dismissed software keyboard, blurred the already-focused hidden
TextInput, and prevented the hardware keyboard from retaining an input responder.Change
No native iOS project, deployment-target, CocoaPods, build, or compilation configuration changes are included.
Verification
pnpm test -- src/terminal/terminal-live-input.test.ts src/terminal/use-terminal-live-input-focus.test.tsFixes #12706
🤖 This content was generated with AI assistance using GPT-5.6 Sol.
Visual Proof
N/A on desktop — mobile-only fix (iPad hardware keyboard focus preservation in the terminal live input). Demonstrating it requires a physical iPad with a hardware keyboard; desktop builds are unaffected.