-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(core): guard TextInput onEnter against IME conversion commits - #6083
fix(core): guard TextInput onEnter against IME conversion commits #6083ManoharPaturi wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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.
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTextInput (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: No visual change across 2 compared shot(s). Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
@cixzhang
cixzhang
left a comment
There was a problem hiding this comment.
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]
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.TextInputchecked onlye.key === 'Enter'; the repo's canonical IME predicate (isImeKeyEvent, checkingisComposingand the legacykeyCode === 229— seeutils/ime.ts) was not applied here, though Selector/Typeahead/TimeInput already guard the same way for their Enter handling.Change
onEnternow fires only fore.key === 'Enter' && !isImeKeyEvent(e.nativeEvent). The consumer'sonKeyDownstill receives every raw keydown, including composing ones, so custom composition handling is unaffected — the guard is scoped to the semanticonEntercallback exactly as the issue requests.Tests
Two new cases in
TextInput.test.tsx, following the existing Selector IME-guard test style (fireEvent.keyDownwithisComposing: trueandkeyCode: 229):onEnter; a subsequent real Enter calls it onceonKeyDownstill fires for composing keydownsvitest run packages/core/src/TextInput→ 76 passed (74 pre-existing + 2 new). Coretsc --noEmit, eslint on touched files,check:sync, andcheck:changesetsall clean. Doc entry notes the IME-safe behavior; changeset included.