Skip to content

Navigation Menu

Sign in
Sign up

fix(core): guard TextInput onEnter against IME conversion commits - #6083

Open
ManoharPaturi wants to merge 1 commit into
facebook:main from
ManoharPaturi:fix/textinput-ime-enter
Open

fix(core): guard TextInput onEnter against IME conversion commits #6083
ManoharPaturi wants to merge 1 commit into
facebook:main from
ManoharPaturi:fix/textinput-ime-enter

Conversation

@ManoharPaturi

@ManoharPaturi ManoharPaturi commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #6082

Summary

Pressing Enter to commit a Japanese/Chinese/Korean IME conversion fired onEnter — so applications using it for submit/save triggered the action before the user intended to submit. TextInput checked only e.key === 'Enter'; the repo's canonical IME predicate (isImeKeyEvent, checking isComposing and the legacy keyCode === 229 — see utils/ime.ts) was not applied here, though Selector/Typeahead/TimeInput already guard the same way for their Enter handling.

Change

onEnter now fires only for e.key === 'Enter' && !isImeKeyEvent(e.nativeEvent). The consumer's onKeyDown still receives every raw keydown, including composing ones, so custom composition handling is unaffected — the guard is scoped to the semantic onEnter callback exactly as the issue requests.

Tests

Two new cases in TextInput.test.tsx, following the existing Selector IME-guard test style (fireEvent.keyDown with isComposing: true and keyCode: 229):

  • composing Enters do not call onEnter; a subsequent real Enter calls it once
  • onKeyDown still fires for composing keydowns

vitest run packages/core/src/TextInput → 76 passed (74 pre-existing + 2 new). Core tsc --noEmit, eslint on touched files, check:sync, and check:changesets all clean. Doc entry notes the IME-safe behavior; changeset included.

Copilot AI lite review requested due to automatic review settings September 6, 2026 06:02

vercel Bot commented Sep 6, 2026
edited
Loading

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 6, 2026 6:06am UTC

Request Review

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Sep 6, 2026
github-actions Bot added a commit that referenced this pull request Sep 6, 2026

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

TextInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 331 -
Complexity N/A Very High (56) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 2 compared shot(s).


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang 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.

Thanks, this keeps IME users from triggering submit or save while committing a candidate. The shared guard covers both the modern isComposing signal and the Safari/legacy keyCode === 229 fallback, still forwards the raw onKeyDown event, and leaves the next ordinary Enter unchanged. The focused TextInput and IME suites pass (80 tests).

[Reviewed by Robohands]

ManoharPaturi reacted with heart emoji
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort, defaults to Lite
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@cixzhang cixzhang cixzhang approved these changes
@imdreamrunner imdreamrunner Awaiting requested review from imdreamrunner imdreamrunner is a code owner
@josephfarina josephfarina Awaiting requested review from josephfarina josephfarina is a code owner

Assignees

No one assigned

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug] TextInput onEnter fires when confirming Japanese IME conversion

AltStyle によって変換されたページ (->オリジナル) /