You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Send mobile chat prompts with a hardware keyboard's Return - #36426
With a keyboard plugged into an iPhone or iPad, pressing Return in Orca's chat box started a new line instead of sending. Now Return sends, the same as on desktop. If you're typing on the on-screen keyboard, Return still starts a new line.
What Changed
Before: in the Native Chat composer and the terminal Message box, a hardware Return inserted a newline. The only way to send was tapping Send.
After: on iOS/iPadOS, Return sends while no on-screen keyboard is up, which is the case when a hardware keyboard is in use. With the on-screen keyboard showing, Return still inserts a newline.
Line breaks are still possible: press Shift+Enter to insert a newline on a hardware keyboard, the same as on desktop. This applies to the chat and terminal screens served by the desktop page bundle (the /h routes), which is where these composers render. On the fallback native field, Shift+Enter also sends, because iOS doesn't report modifier keys to React Native. Use the on-screen keyboard's Return there for a newline.
After a hardware Return send, both the chat composer and the terminal Message box keep focus so the next message can be typed straight away. The Send button still dismisses the keyboard as before.
How it works: a new useHardwareKeyboardEnterSubmit hook (mobile/src/components/composer-input/) reads the existing soft-keyboard state from useSoftKeyboard. If no soft keyboard is showing, or only one shorter than 150pt (iOS's hardware-keyboard shortcut bar), it treats Return as send. The page-bundle path measures the keyboard height at each keypress, so a composer that mounts under an already-open keyboard keeps its newline.
Page bundle (.web.ts, which renders the /h routes): react-native-web ignores submitBehavior, and blurOnSubmit would drop focus after each send. So the hook cancels the plain Enter keydown and sends. Shift/Alt/Ctrl/Cmd+Enter and IME composition are left alone, so Shift+Enter keeps its newline.
Native field (.ts): switches submitBehavior between submit and newline. iOS reports neither modifiers nor key source to React Native, so Shift+Enter also sends on this path.
Both composers only pass a submit callback when there is something to send, so an empty draft never fires a bare Enter at the terminal.
Why
React Native and WebKit report the same Return key for the on-screen and hardware keyboards. Whether a full-height soft keyboard is showing is the signal the app already tracks that tells them apart. Changing every Return to send would break newlines for people typing on the glass. A Cmd+Enter-only shortcut (#21238) doesn't reach the native field, which never sees modifiers.
N/A for now: this is a keyboard behavior change with no visual difference. I haven't tested it end to end yet. The /h routes come from the desktop-served page bundle, so it needs a desktop built from this branch.
Testing
I manually tested these changes locally. A Release build of this branch is installed on an iPhone 16 Pro Max with a hardware keyboard. The chat screen there is served by the released desktop's page bundle, so the page-bundle path still needs testing with a desktop built from this branch.
Automated tests added/updated: hardware-keyboard-enter-submit.web.test.ts renders a real react-native-web multiline TextInput and checks that plain Enter sends and blocks the newline, while Shift+Enter and IME-composing Enter fall through to the textarea's line break. hardware-keyboard-enter-submit.test.tsx covers the native decision logic (no keyboard → submit, shortcut bar → submit, soft keyboard → newline, mounted under an open keyboard → newline, nothing to send or not iOS → untouched). Existing composer/dock test mocks gained Keyboard.addListener / Platform, which the composer now reaches.
Ran vitest across mobile/ (all pass except mobile-agent-launch-architecture.test.ts, which also fails on the base commit, and two suites that need the root oxc-parser install) and the mobile typecheck.
AI Disclosure
Written with Claude Code (Claude Opus 5.5).
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Cross-platform: iOS/iPadOS only. Android is unchanged, since its IME caches the Enter-key config at focus, which needs separate handling.
Remote/mixed versions: the page-bundle half ships with desktop, the native half with the app. Either works without the other.
Known quirk: an iPad floating soft keyboard reports a small frame and so would send on Return. The Send button is unaffected.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The change adds iOS and web hooks that submit on hardware-keyboard Enter when the soft keyboard is not active. The hooks preserve newline behavior for a visible soft keyboard, modified Enter, or IME composition as applicable to each platform. Native Chat and the session command dock use the hooks. Their send paths can retain focus, and related tests and keyboard mocks are updated.
Severity of issue fixed: Medium
Merge Risk: Low · up to 3759e
Hardware Return now saves an active chat edit rather than inserting a newline. Confirm that this edit behavior is intended; otherwise the change is mergeable with bounded owner awareness.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Linked Issues check
Issue [#14744] requires Cmd+Enter to send and plain Enter to insert a newline. The web hook ignores all modified Enter events, so Cmd+Enter does not send. The native hook cannot inspect modifier…
Implement one of the shortcut contracts accepted by issue [#14744] on the Native Chat path. The implementation must provide the required send and newline behavior, prevent submission during native IME composition, and add tests for the nati…
Docstring Coverage
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: sending mobile chat prompts with a hardware keyboard's Return key.
Description check
The description is mostly complete and covers the user impact, implementation, rationale, linked issue, testing, platform scope, known limitation, and checklist. The Risk section and explicit risk lev…
Out of Scope Changes check
The hook, keyboard-state detection, composer integration, focus retention, send-state gating, tests, and React Native mock updates support hardware-keyboard submission. The terminal Message box uses t…
Full details: Description check
Explanation
The description is mostly complete and covers the user impact, implementation, rationale, linked issue, testing, platform scope, known limitation, and checklist. The Risk section and explicit risk level are missing, and end-to-end testing plus several validation commands remain incomplete.
Full details: Out of Scope Changes check
Explanation
The hook, keyboard-state detection, composer integration, focus retention, send-state gating, tests, and React Native mock updates support hardware-keyboard submission. The terminal Message box uses the same related composer behavior and send-path focus option. No demonstrated change is unrelated to this keyboard-submission objective.
Full details: Linked Issues check
Explanation
Issue [#14744] requires Cmd+Enter to send and plain Enter to insert a newline. The web hook ignores all modified Enter events, so Cmd+Enter does not send. The native hook cannot inspect modifiers and submits every Return when no full-height soft keyboard is visible, so plain hardware Enter cannot insert a newline and native Shift+Enter also sends. The native path also has no IME-composition guard. The implementation does reuse the existing send path, preserves empty or disabled-send gating, keeps the on-screen Send button, and adds web IME coverage.
Resolution
Implement one of the shortcut contracts accepted by issue [#14744] on the Native Chat path. The implementation must provide the required send and newline behavior, prevent submission during native IME composition, and add tests for the native modifier or composition cases.
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 16 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Keep the composer focused after a hardware-keyboard send. · MobileNativeChatComposer.tsx:244
mobile/src/session/native-chat/composer/MobileNativeChatComposer.tsx:244 Minor · Functional Correctness · Quick win
Keep the composer focused after a hardware-keyboard send.
On iOS, a successful hardware-keyboard Return submission uses submitBehavior: 'submit' and calls handleSend. For regular chat sends, that path still calls Keyboard.dismiss(), which removes focus. Keep dismissal for Send button submissions, but skip it for hardware-keyboard submissions.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f3005425-c21a-405a-a431-05009a2e7a0c
Commits
Reviewing files that changed from the base of the PR and between eb3379f and 67a5c6b.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (2)
Minor · Seed the web keyboard state before enabling the… · hardware-keyboard-enter-submit.web.ts:22-36
mobile/src/components/composer-input/hardware-keyboard-enter-submit.web.ts:22-36 Minor · Functional Correctness · Quick win
Seed the web keyboard state before enabling the Enter handler.
useSoftKeyboard() initializes with height 0 and reads current keyboard metrics only in an effect. When the page-bundle composer mounts while an iOS/iPadOS soft keyboard is already open, the first render can enable the Enter handler. A plain Enter during that window calls preventDefault() and onSubmit() instead of inserting a newline.
Initialize the state with currentSoftKeyboardHeight so the handler uses the current keyboard state on its first render.
Minor · Preserve focus for hardware sends from the command dock. · MobileSessionCommandDock.tsx:82-84
mobile/src/session/MobileSessionCommandDock.tsx:82-84 Minor · Functional Correctness · Quick win
Preserve focus for hardware sends from the command dock.
The dock’s hardware-Enter handler calls handleSend() without a focus-retention option. For an accepted, unchanged-draft send on a running agent terminal, this reaches dismissTerminalKeyboard, which blurs commandInput. Add a hardware-send-only option and keep the existing Send-button behavior unchanged.
Suggested fix
- async function handleSend() {+ async function handleSend(options: { keepFocus?: boolean } = {}) {
...
- dismissKeyboardAfterAgentSend(sendOrigin, accepted && draftUnchanged)+ if (!options.keepFocus) {+ dismissKeyboardAfterAgentSend(sendOrigin, accepted && draftUnchanged)+ }
MobileSessionCommandDock spreads enterSubmit into MessageBox, but this mock forwards only three props. The current test also renders an empty draft and checks focus only, so it cannot detect Enter forwarding or handler invocation. Forward the remaining props and add a focused non-empty-draft assertion for plain Enter invoking handleSend.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
On iPhone and iPad, Return on a connected keyboard inserted a newline in
the chat composer and the terminal Message box, so a prompt could only be
sent by tapping Send. Return now sends while no on-screen keyboard is up;
with the on-screen keyboard it still inserts a newline.
The page bundle cancels the plain Enter keydown, so Shift+Enter keeps its
newline there. The native field switches submitBehavior, because iOS
reports neither modifiers nor key source to React Native.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Skip the post-send keyboard dismissal when a hardware Return sent the
message, and seed the native keyboard state from metrics so a composer
mounted under an open soft keyboard keeps Return as a newline.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The page composer now reads the soft keyboard height when Return is
pressed, so one mounted under an open keyboard keeps its newline. A
hardware Return send from the terminal Message box keeps the field
focused, matching the chat composer.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
270-271: Major · Functional Correctness · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Keep hardware Return as a newline while editing.
If editSession is active and canSend is true, this callback sends the edit when the user presses hardware Return. The edit controls use handleSend() for Save, so Return can commit an edit that the user intended to continue. Exclude editSession from the Enter-submit callback; leave Save on its existing action. (raw.githubusercontent.com)
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cf5d0128-562f-4251-b0cd-310ea9b53205
Commits
Reviewing files that changed from the base of the PR and between a9170a6 and 3759ead.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Thank you @hjhart for this! We shipped this in #38267, which carries your key-cancellation and focus-preservation work, with you credited as co-author on the commit. iPad users can now send a chat message with Cmd+Enter from a hardware keyboard (Ctrl+Enter on Android). Closing this one since #38267 covers it. Really appreciate the contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
With a keyboard plugged into an iPhone or iPad, pressing Return in Orca's chat box started a new line instead of sending. Now Return sends, the same as on desktop. If you're typing on the on-screen keyboard, Return still starts a new line.
What Changed
Before: in the Native Chat composer and the terminal Message box, a hardware Return inserted a newline. The only way to send was tapping Send.
After: on iOS/iPadOS, Return sends while no on-screen keyboard is up, which is the case when a hardware keyboard is in use. With the on-screen keyboard showing, Return still inserts a newline.
After a hardware Return send, both the chat composer and the terminal Message box keep focus so the next message can be typed straight away. The Send button still dismisses the keyboard as before.
How it works: a new
useHardwareKeyboardEnterSubmithook (mobile/src/components/composer-input/) reads the existing soft-keyboard state fromuseSoftKeyboard. If no soft keyboard is showing, or only one shorter than 150pt (iOS's hardware-keyboard shortcut bar), it treats Return as send. The page-bundle path measures the keyboard height at each keypress, so a composer that mounts under an already-open keyboard keeps its newline..web.ts, which renders the/hroutes): react-native-web ignoressubmitBehavior, andblurOnSubmitwould drop focus after each send. So the hook cancels the plain Enterkeydownand sends. Shift/Alt/Ctrl/Cmd+Enter and IME composition are left alone, so Shift+Enter keeps its newline..ts): switchessubmitBehaviorbetweensubmitandnewline. iOS reports neither modifiers nor key source to React Native, so Shift+Enter also sends on this path.Both composers only pass a submit callback when there is something to send, so an empty draft never fires a bare Enter at the terminal.
Why
React Native and WebKit report the same Return key for the on-screen and hardware keyboards. Whether a full-height soft keyboard is showing is the signal the app already tracks that tells them apart. Changing every Return to send would break newlines for people typing on the glass. A Cmd+Enter-only shortcut (#21238) doesn't reach the native field, which never sees modifiers.
Linked Issue
Fixes #14744
Visual Proof
N/A for now: this is a keyboard behavior change with no visual difference. I haven't tested it end to end yet. The
/hroutes come from the desktop-served page bundle, so it needs a desktop built from this branch.Testing
hardware-keyboard-enter-submit.web.test.tsrenders a real react-native-web multilineTextInputand checks that plain Enter sends and blocks the newline, while Shift+Enter and IME-composing Enter fall through to the textarea's line break.hardware-keyboard-enter-submit.test.tsxcovers the native decision logic (no keyboard → submit, shortcut bar → submit, soft keyboard → newline, mounted under an open keyboard → newline, nothing to send or not iOS → untouched). Existing composer/dock test mocks gainedKeyboard.addListener/Platform, which the composer now reaches.Ran
vitestacrossmobile/(all pass exceptmobile-agent-launch-architecture.test.ts, which also fails on the base commit, and two suites that need the rootoxc-parserinstall) and the mobile typecheck.AI Disclosure
Written with Claude Code (Claude Opus 5.5).
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code