fix: insert newline on Enter in mobile new-chat composer - #212
Merged
yongkangc merged 2 commits intoJun 23, 2026
Conversation
The new-chat composer submitted on Enter even on mobile because NewChatForm did not pass isMobile to shouldSubmitOnEnter, unlike the in-chat PromptComposer. On mobile, Enter now inserts a newline; submission is via the send button only.
yongkangc
enabled auto-merge (squash)
June 23, 2026 07:18
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.
Problem
On mobile, pressing Enter in the initial new-chat composer (the "Project Path" / New Chat dialog) immediately starts the session instead of inserting a newline. This makes it impossible to type a multi-line first message on a phone without accidentally sending. The in-chat composer already behaves correctly (Enter inserts a newline; submit is via the send button).
Solution
NewChatFormalready tracksisMobilevia a(max-width: 768px)media query but never passed it toshouldSubmitOnEnter, so the mobile guard was inert. PassisMobileinto the call, matchingPromptComposer.shouldSubmitOnEnteralready returnsfalse(do not submit) whenisMobileis true.Changes
web/src/lib/components/chat/NewChatForm.svelte: passisMobiletoshouldSubmitOnEnter.web/src/lib/components/chat/__tests__/NewChatFormTestHost.svelte: exposeonStartChatso tests can assert submission.web/src/lib/components/chat/__tests__/NewChatForm.test.ts: add regression tests — Enter does not submit on mobile (newline), Enter still submits on desktop.Expected Impact
On mobile, Enter inserts a newline in the new-chat composer; submission happens only via the send button. Desktop behavior is unchanged. Keyboard and button submit gates now stay consistent with the in-chat composer. Verified in-browser at a 390x844 viewport and with
bun run checkplus the full web test suite (1348 tests) passing.