fix(app): allow Enter to send in mobile chat input (Shift+Enter for newline) - #556
fix(app): allow Enter to send in mobile chat input (Shift+Enter for newline)#556synth-mania wants to merge 1 commit into
Conversation
Mobile layouts required Ctrl/Meta+Enter to send (agegr#472), which left hardware/Bluetooth keyboards with no way to send. Enter now sends on every layout (Shift+Enter inserts a newline), matching desktop.
|
Hey guys, it's me, the human behind the agent that made this PR. I thought we should unify physical keyboard behavior across mobile and desktop platforms. If you aren't comfortable with the manner in which this PR was authored, I would be happy to close the request. |
|
I hope macOS will support option + return. |
|
Hi, I’m the person who introduced the PR mentioned above. Sorry for the inconvenience. However, if pressing Enter by itself is used to send the message, there’s no way for mobile users to start a new line in the mobile layout when no external keyboard is attached, since the default on-screen keyboards on both iOS and Android don’t send Also, all major mobile LLM apps, including Claude, ChatGPT, and Gemini, use Enter to create a new line, while desktop apps use Enter to send the message (except Claude). |
|
Thanks for the PR. We’re going to keep the mobile behavior introduced in #472: Enter inserts a newline, and the send button submits the message. Mobile software keyboards generally have no Shift+Enter, so this change would make multiline input impossible. Since the browser cannot reliably distinguish software keyboards from external keyboards, we won’t merge this PR. |
Summary
On mobile layouts (viewport ≤ 640px),
Enteronly inserts a newline andsending requires
Ctrl+Enter/Cmd+Enter(introduced in #472). With aphysical or Bluetooth keyboard attached to a phone, plain
Enterappearsbroken and the
Ctrl/Meta+Enterchord is awkward to discover and hit.This makes mobile behave like desktop: Enter sends, Shift+Enter inserts a
newline — the convention used by WhatsApp, Telegram, iMessage, Slack, etc.
Change
components/ChatInput.tsx— drop the mobile-only modifier requirement inhandleKeyDown:Notes / tradeoffs
Enterfor newlines in mobile chat input #472 intentionally madeEnter= newline on mobile for touch keyboards.With this change the on-screen keyboard's Return key sends (the pre-fix(app): allow
Enterfor newlines in mobile chat input #472send behavior); the send button remains for touch users.
Ctrl+Enter/Cmd+Enterchord still works (it satisfiesEnter && !shiftKey), so nothing existing stops working.isComposing/ keyCode 229 / 100 ms compositiongrace) is untouched, so
Enternever sends mid-composition.Enternow also confirms highlighted slash-command / @file /history menu items, consistent with desktop.
isMobileremains in use for layout; no other behavior changes.Test plan
Ctrl+Enter still sends.
layouts.
tsc --noEmitclean.npm test: 586/587 pass locally; the singlefailure (
lib/web-auth.test.mjs, password auth) reproduces on the cleantree, i.e. pre-existing and unrelated to this change.