fix(mobile): send on Ctrl/Cmd+Enter from a hardware keyboard on Android - #8362
fix(mobile): send on Ctrl/Cmd+Enter from a hardware keyboard on Android#8362sideeffffect wants to merge 1 commit into
Conversation
On Android the composer had no way to send from a hardware keyboard: plain Enter inserts a newline (correct for touch) and no modifier shortcut was wired, so Bluetooth-keyboard users on tablets and phones were stuck. iOS already sends on Cmd+Enter through an onComposerSubmit event, but the Android native module, view, and JS bridge never implemented it. Wire the same onComposerSubmit path on Android: the native EditText now detects Ctrl/Meta+Enter and emits onComposerSubmit, and the Android JS bridge (T3ComposerEditor.native.tsx) forwards it to the composer's onSubmit, mirroring the iOS variant. Plain Enter still inserts a newline. Done by Claude Opus 4.8 via Claude Code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small Android-only parity fix that connects Ctrl/Meta+Enter to the existing send handler while preserving plain Enter newline behavior. It is isolated to native keyboard handling and event wiring, with no schema, security, billing, deployment, or shared-infrastructure impact. You can add or adjust custom eligibility rules. Learn more. |
Problem
On the Android app, there is no way to send a message from a hardware (e.g. Bluetooth) keyboard. Plain Enter inserts a newline — correct for touch — but no modifier shortcut was wired, so tablet/phone users with a keyboard attached are stuck reaching for the on-screen Send button.
iOS already handles this: the Swift view registers a
Cmd+Enterkey command and emits anonComposerSubmitevent, whichT3ComposerEditor.ios.tsxforwards to the composer'sonSubmit. The Android side never implementedonComposerSubmit— not in the native module, not in the view, and not in theT3ComposerEditor.native.tsxbridge.Fix
Wire the same
onComposerSubmitpath on Android, mirroring iOS:T3ComposerEditorModule.kt— declare theonComposerSubmitevent.T3ComposerEditorView.kt— the nativeEditTextnow detects Ctrl/Meta+Enter inonKeyDownand emitsonComposerSubmit; plain Enter falls through to the default multiline newline insertion.T3ComposerEditor.native.tsx— declare and forwardonComposerSubmitto the composer'sonSubmit, exactly as the iOS variant already does.Ctrl+Enter is the Android convention (matching iOS's Cmd+Enter); Meta is accepted too for external keyboards that map a Command/Meta key.
Surfaces
composer-logic.ts) and is out of scope for this PR to keep it to one concern.Testing
vp run typecheck(mobile) — pass.vp run lint:mobile(ktlint 1.8.0 + detekt againstdetekt.yml --build-upon-default-config) — pass.I don't have a device set up to capture a hardware-keyboard video; happy to add one if a maintainer can point me at the mobile e2e harness.
Done by Claude Opus 4.8 via Claude Code.
Note
Low Risk
Localized Android composer keyboard handling with no auth, data, or shared business-logic changes; behavior aligns with existing iOS submit path.
Overview
Android composer now matches iOS for keyboard send: hardware Ctrl/Meta+Enter triggers submit; plain Enter still inserts a newline in the multiline editor.
The Expo module declares
onComposerSubmit, the nativeEditTexthandles the shortcut inonKeyDown, andT3ComposerEditor.native.tsxforwards it to the composer'sonSubmitprop (same wiring as the iOS bridge).Reviewed by Cursor Bugbot for commit 094a8d2. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Send submit event on Ctrl/Cmd+Enter from hardware keyboard on Android composer
submitListenercallback toSelectionAwareEditTextthat fires on Ctrl+Enter or Meta+Enter, consuming the key event so plain Enter still inserts a newline.T3ComposerEditorViewto dispatch anonComposerSubmitevent, exported byT3ComposerEditorModule.onSubmitprop from theComposerEditorReact component to the native view asonComposerSubmit.onKeyDownoverride inSelectionAwareEditTextconsumes Ctrl/Meta+Enter before default handling; verify no other key handlers depend on receiving that event.Macroscope summarized 094a8d2.