Skip to content

[codex] fix mobile composer Enter behavior#3930

Open
maxwellyoung wants to merge 1 commit into
pingdotgg:mainfrom
maxwellyoung:codex/fix-mobile-composer-newlines
Open

[codex] fix mobile composer Enter behavior#3930
maxwellyoung wants to merge 1 commit into
pingdotgg:mainfrom
maxwellyoung:codex/fix-mobile-composer-newlines

Conversation

@maxwellyoung

@maxwellyoung maxwellyoung commented Jul 13, 2026

Copy link
Copy Markdown

Fixes #2478

Problem

On mobile web viewports, pressing the software keyboard's Enter key immediately submits the composer. That makes it impossible to write a multi-line prompt without switching to another input method.

Root cause

ChatComposer already tracks whether the composer is rendered at a mobile viewport, but its command-key handler treated every unshifted Enter press as a submit action. The handler consumed the event before Lexical could insert a line break.

Fix

  • Allow plain Enter to fall through to Lexical on mobile viewports so it inserts a newline.
  • Preserve the existing desktop behavior: plain Enter submits and Shift+Enter inserts a newline.
  • Add focused unit coverage for the mobile and desktop decision matrix.

Visual verification

Verified in the live web app at a 390 x 844 viewport.

  • Left: baseline after pressing Enter; First line was submitted immediately.
  • Right: fixed behavior after pressing Enter and typing Second line; both lines remain in the composer.

Before and after comparison

The interaction-state GIF alternates between the baseline submitted state and the fixed multiline draft state:

Interaction state comparison

The fixed editor DOM contained a <br> between the two lines, and the route remained a draft rather than creating a submitted thread.

Validation

  • vp check (passes; reports existing react(no-unstable-nested-components) warnings outside this diff)
  • vp run typecheck
  • pnpm --filter @t3tools/web test - 148 files, 1,283 tests passed
  • Playwright browser verification at 390 x 844

Web/shared impact

This only changes the web chat composer keyboard behavior at mobile viewport widths. Desktop plain-Enter submission is covered by the new test and remains unchanged. The native mobile app, server, provider adapters, shared packages, and contracts are unaffected.

Migration/deploy impact

None. There are no schema, migration, API, auth, session, realtime transport, or deployment configuration changes.

Post-deploy smoke check

  1. Open the web app at a mobile viewport.
  2. Type one line, press Enter, and type a second line.
  3. Confirm both lines remain in the composer until the send button is tapped.
  4. On desktop, confirm plain Enter still submits and Shift+Enter still inserts a newline.

Note

Fix Enter key submission behavior in mobile chat composer

On mobile viewports, pressing plain Enter in the chat composer no longer submits the message. A new shouldSubmitComposerOnEnter helper in composer-logic.ts centralizes the logic: returns true only on non-mobile viewports without Shift held. ChatComposer now delegates to this helper instead of checking !event.shiftKey alone.

Macroscope summarized abfd136.


Note

Low Risk
Localized web composer keyboard handling with no API, auth, or data changes; desktop submit behavior is preserved and covered by tests.

Overview
On mobile web viewports, plain Enter in the chat composer no longer triggers send. ChatComposer now calls shouldSubmitComposerOnEnter instead of treating every unshifted Enter as submit, so the key can reach Lexical and add a line break.

Desktop behavior is unchanged: plain Enter still submits; Shift+Enter still adds a newline. The decision lives in composer-logic.ts with unit tests for mobile, desktop, and Shift+Enter.

Reviewed by Cursor Bugbot for commit abfd136. Bugbot is set up for automated code reviews on this repo. Configure here.

@maxwellyoung maxwellyoung changed the title fix(web): insert newlines from mobile Enter [codex] fix mobile composer Enter behavior Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8de9fc24-fa9a-43aa-9fcc-85f50e220317

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jul 13, 2026
@maxwellyoung maxwellyoung marked this pull request as ready for review July 13, 2026 06:39
@macroscopeapp

macroscopeapp Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Simple, well-tested bug fix that adjusts Enter key behavior on mobile viewports. The new utility function is straightforward boolean logic with clear test coverage documenting the expected behavior.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: New line on mobile browser (chrome based) just send the message

1 participant