fix(app): allow Enter to send in mobile chat input (Shift+Enter for newline) - #556
Open
synth-mania wants to merge 1 commit into
Open
fix(app): allow Enter to send in mobile chat input (Shift+Enter for newline)#556synth-mania wants to merge 1 commit into
synth-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.
Author
|
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. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.