Skip to content

ui-react: Enter in text fields outside the Composer acts on half-composed IME input #2579

Open

Description

@schlessera

Context

Part of #2576. #1810 owns the Composer textarea. This task covers every other custom Enter handler on a text field.

These handlers act on Enter without checking for an active IME composition. A user confirming a Japanese, Chinese or Korean candidate therefore submits, saves or renames with half-composed text:

Site Action on Enter
(SkillsList, packages/ui-react/src/components/settings/skills-list.tsx:67-69) create skill
skills-list.tsx:109-111 install from GitHub
(OpenRouterSection, packages/ui-react/src/components/settings/models-list.tsx:189-191) add model
(KeyEditor, packages/ui-react/src/components/settings/web-search-chain.tsx:262-264) save API key
(PasskeyRow, packages/ui-react/src/components/settings/passkey-list.tsx:149-152) commit rename (Escape cancels it)
(handleKeyDown, packages/ui-react/src/components/quick-actions/search-modal.tsx:148-166) open result or run search
(onKeyDown, packages/ui-react/src/components/layout/desktop-palette.tsx:146-156) activate palette row
(TagsField, packages/ui-react/src/components/settings/module-settings-fields.tsx:177) add tag
(AskOtherField, packages/ui-kit/src/internal/AskOtherField.tsx:41-45) submit "Other" answer. It checks isComposing only when p.value !== undefined, so the uncontrolled field is unguarded.
(onKeyDown, packages/ui-react/src/components/quick-actions/add-form.tsx:58-64) Cmd/Ctrl+Enter save

No enterKeyHint is set anywhere in either package (grep -rn enterKeyHint packages/ui-*/src is empty), so Android keyboards show a generic return key even where Enter sends, searches or saves.

Guide forms/ime-safe-enter-submit: "The composition-active check applies to any custom keydown handler that acts on Enter, not only to multiline <textarea> fields". The guide recommends pairing event.isComposing with event.keyCode === 229 to catch Safari's out-of-order confirming Enter. Guide forms/forms: "DO use enterkeyhint to set the Enter key label".

Scope

  • Add one helper in packages/ui-kit/src/internal/ that returns true when a key event is composing: nativeEvent.isComposing || keyCode === 229, evaluated only after the key is known to be Enter or Escape. Export it through @schlessera/brain-ui-kit/internal for ui-react.
  • Every site in the table returns early on a composing Enter. Where the site handles Escape (passkey rename), it also returns early on a composing Escape. It returns before calling preventDefault(), so the IME keeps its own default.
  • AskOtherField checks composition in both controlled and uncontrolled use.
  • Add enterKeyHint: "send" on the kit Composer textarea (Enter sends at every width), "search" on the search modal, "go" on the desktop palette and the GitHub install field, and "done" on the remaining single-value fields.

Out of scope

Acceptance criteria

  • Every row in the table uses the shared helper. grep -rn '"Enter"' packages/ui-react/src shows no text-field handler without it.
  • A composing Enter (and, for the passkey rename, a composing Escape) does not run the action and does not call preventDefault(). A plain Enter runs it once.
  • A browser test uses CDP Input.imeSetComposition with trusted keys, the method ui-kit: Composer shortcuts send or stop during IME composition #1810 used, on at least the search modal and the uncontrolled AskOtherField. It fails on the current tree (the action runs) and passes after. A mutation that removes the helper's check makes it fail again. Record both in the PR.
  • The enterKeyHint values above are present in the rendered DOM.
  • Changeset for both packages (patch).

Verification

bun run test packages/ui-kit packages/ui-react
node scripts/visual.mjs --project=ui-react-layout
bun run typecheck
bun run lint
bun run check:pr --base origin/main

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

No API changes. The helper ships on the unsupported /internal entry.

Activity

  1. added
    type: fixSomething is broken and must behave the way it is documented.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions