Skip to content

feat(ChatComposerInput): the touch keyboard's Return key says Send - #8167

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c08-composer-return
Nov 2, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c08-composer-return

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

User need

ChatComposerInput sends on Return, on every keyboard (component:ChatComposerInput FR2), but a phone's keyboard shows a plain Return key, so a person expecting a line break sends a half-written message. UIKit's returnKeyType = .send labels the key; Mobile Safari applies it from enterkeyhint="send".

Problem and solution fit

  • The editor renders enterkeyhint="send": the touch keyboard shows its Send key (a blue up arrow on iOS 26). ChatComposer's default input carries the same default.
  • A new enterKeyHint prop relabels it for a composer whose onKeyDown makes Enter a line break on touch; the Enter behavior story passes enter.
  • It only labels the key: Enter submits under every label.

Current specification

component:ChatComposerInput FR17 and DEC-2, recorded in #9424, with enterKeyHint typed by EnterKeyHint (component:TextInput FR16). FR2 is unchanged. This pull request closes FR17's implementation and evidence gaps. The record edit is owner-gated: it needs an engineering owner's /approve-spec at this exact head.

Each API report row this pull request adds is decided by a current record (architecture:public-component-api INV25): this prop by component:ChatComposerInput FR17, and the text fields' props, type values and unions by component:TextInput FR16 and AR6 and component:TextArea FR13.

Public delta and caller burden

  • enterKeyHint?: EnterKeyHint, default 'send': optional and additive, a patch [feat]. EnterKeyHint is the closed union the package entry exports for the text fields, so TypeScript rejects any other value.
  • Every ChatComposer gets the Send key with no code change; a caller whose Enter inserts a line break on touch passes enterKeyHint="enter". No theming or accessibility change (enterkeyhint is not announced).
  • Core's API report gains this prop's row, and, at the maintainers' request, the rows for the text fields' keyboard props, type values and exported unions, which feat(TextInput,TextArea): tell a touch keyboard what the field holds #8166 merged without. Rows that other changes left stale (two input status styles' forced-colors value, the input wrapper and display styles, a CSS variable, and a CLI template field) are not touched here.
// default: the key says Send
<ChatComposer onSubmit={send} />
// a composer that keeps Return a line break on touch keyboards
<ChatComposerInput enterKeyHint="enter" onKeyDown={e => { if (isTouch && e.key === 'Enter' && !e.shiftKey) e.preventDefault(); }} />

Design and alternatives

DEC-2: Enter sends, so the editor labels the key Send itself, as a component decides what it can derive. No default would keep a label that contradicts what Enter does, and the label can't be derived from onKeyDown: what a handler does with Enter is unknown until it runs.

Evidence

iOS 26.2 simulator, the composer inside ChatLayout with #8176 (which keeps it above the keyboard), home-screen web app (keyboard in frame): the Send key, then Done.

In ChatLayout

Mobile Safari, the composer's own stories: before (Return), after (Send), and the Enter behavior story (Return).

Composer Return key before and after

Android, Chrome 124 with Gboard (emulator): the same three, then a message typed with Gboard and sent with its Send key.

Composer action key on Android
Sending with Gboard's Send key

  • Chromium on a phone viewport with touch emulation: ChatComposerReturnKey.a11y.chromium.spec.ts taps the editor of the Simplest story (Send) and of the Enter behavior story (Return, enter): 20 of 20 runs alone, and 20 of 20 at 4 workers on two pinned cores.
  • Render tests: send by default, the value passed, send inside ChatComposer's default input, and Enter submitting under each of the seven labels.
  • Type test (ChatComposerInput.public.test.ts, run by pnpm typecheck): enterKeyHint is EnterKeyHint, and an arbitrary or unnarrowed string is rejected. Widening the prop's type with string makes it report 4 errors.
  • Red first, on main's ChatComposerInput.tsx: the three label tests fail (the default label, the default label inside ChatComposer, and a passed label), and the file's other 104 tests pass, the Enter cases included, since they guard FR2. Against a Storybook built from main's source and stories, the Chromium spec fails both cases: enterkeyhint reads null where send and enter are expected.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

  • R1 narration: none found; the edited rows state behavior and name tests.
  • R2 research in the record: none.
  • R3 evidence naming a change: none; the verification row names test files.
  • R4 rejected alternatives over one line or outside a decision: none added.
  • R5 pull request or issue references remaining: none.
  • R6 ruled open questions still listing options: none.

Testing

  • Local gates at bb50383 (one commit on main 1667ea8): core typecheck (the public type test included), strict lint (ASTRYX_STRICT_LINT=1 pnpm lint), Prettier, the knowledge checks, the Chat suites (436 tests) and the CLI documentation suites (2,595) pass. At 6a257e0503, whose code differs from this head only in comments and the record's verified_by list, the build, the whole typecheck and the API report ran: pnpm api:report there differs from the committed reports only by rows that other changes left stale, five in core's report and one CLI field. The comment-provenance baseline check fails on main at this base too, on four entries in files this pull request does not touch.

Notes

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 2, 2026 7:48pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 2, 2026, 7:57 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No defects turned up: the implementation, tests and docs agree, and Enter still submits as component:ChatComposerInput FR2 requires. Approval waits on one owner decision, because no current spec admits the new public enterKeyHint prop or its 'send' default, which changes the Return key of every existing composer on touch keyboards. An engineering owner needs to settle whether ChatComposerInput admits enterKeyHint with default 'send', knowing that composers whose Enter inserts a line break on touch would then pass enterKeyHint="enter", and records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and the ruling then goes into the component's spec record.

[Automated review]

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:32
@vjeux
vjeux force-pushed the uikit/c08-composer-return branch from c6007a0 to eb8cab6 Compare November 2, 2026 04:11
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to approve: the composer's send default and enterKeyHint prop, and the TextInput and TextArea keyboard-trait props carried from #8166, match the current component specs, and the new tests cover the attributes, the types and unchanged Enter handling. The three spec record edits only remove implementation gaps, but the repository's spec gate still needs an engineering owner to comment /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner). After that, land #8166 first or together with this branch.

[Automated review]

component:ChatComposerInput FR17 and DEC-2. Enter sends the draft, so the
editor now sets enterkeyhint="send" and iOS shows its Send key instead of
a plain Return; ChatComposer's default input carries the same default. A
new enterKeyHint prop takes another label, such as `enter` for a composer
whose onKeyDown makes Enter insert a line break on a touch screen. The
hint only labels the key: Enter submits under every label.

enterKeyHint takes the closed union EnterKeyHint the package entry
exports (component:TextInput FR16), so TypeScript rejects any other
value; a public type test pins it. The record's implementation and
evidence gaps for FR17 are closed, and a Chromium spec checks, on a phone
viewport with touch emulation, the label on the editor a tap focuses.

Core's API report gains this prop and the text fields' keyboard props and
unions, which merged without their report rows. Rows that other changes
left stale are not touched here.
@vjeux
vjeux force-pushed the uikit/c08-composer-return branch from eb8cab6 to bb50383 Compare November 2, 2026 19:37
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

/approve-spec bb50383

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to approve: the editor's send default and the new enterKeyHint prop match the current ChatComposerInput spec (FR17), and the API report rows added for the TextInput and TextArea keyboard props match their current specs. The new render tests, the public type test and the Chromium Return-key spec fail against the base and pass on this branch, and Enter still submits under every label.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 2, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 2, 2026 20:12
@cixzhang
cixzhang merged commit 65ad191 into meta:main Nov 2, 2026
107 checks passed
@vjeux
vjeux deleted the uikit/c08-composer-return branch November 2, 2026 20:36

This branch was successfully deployed

1 active deployment
Preview — bb503839 Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants