Skip to content
Source
Sign inSign up
pingdotgg/t3code

[codex] fix mobile composer Enter behavior #3930

Mergedmaxwellyoung(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/3930/headmerged by juliusmarminge View on GitHub

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 26e49d1.

Note

Low Risk Narrow web-only keyboard UX change in the chat composer with unit tests; no API, auth, or server impact.

Overview On mobile web (max-sm), plain Enter in the chat composer no longer submits—the command-key handler only intercepts Enter when shouldSubmitComposerOnEnter says so, so Lexical can insert a line break.

Adds shouldSubmitComposerOnEnter in composer-logic.ts (submit when desktop and not Shift+Enter). ChatComposer wires it with existing isMobileViewport instead of treating every unshifted Enter as send. Desktop behavior is unchanged: Enter sends, Shift+Enter newline. Send on mobile stays via the send button / form submit path.

Unit tests cover desktop Enter, mobile Enter, and Shift+Enter.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 26e49d1bf50feaea79ef10f116ea2978e6493f0e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 53309fc0-2edc-4244-bdf2-4130ae3d0afb

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge approved these changes

    5. juliusmarminge merged this6a17629

    6. juliusmarminge closed this

Sign in to join this conversation.