-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Bug] TextInput onEnter fires when confirming Japanese IME conversion #6082
Description
Description
TextInput calls onEnter when Enter is used to confirm a Japanese IME conversion. Applications using this callback for submission or saving can therefore trigger the action before the user intends to submit.
Expected: Enter used to confirm an IME conversion should not call onEnter. A subsequent Enter after composition has finished should call it once.
Actual: Confirming the conversion to 日本語 also increments the onEnter counter from 0 to 1, as shown in the recording.
astryx/packages/core/src/TextInput/TextInput.tsx
Lines 431 to 438 in cde73c7
TextInput checks only e.key === 'Enter' before calling onEnter. The existing isImeKeyEvent helper checks both isComposing and keyCode === 229, but is not used here.
Related: #4892 (systematic IME composition guards).
Reference
GoogleChrome modern-web-guidance: IME-safe enter-to-submit (v0.0.186) explains composition checks for custom Enter handlers, including Safari event-ordering behavior and the keyCode === 229 fallback. Its examples use a textarea; this report concerns TextInput's custom keydown callback, rather than native implicit form submission.
Reproduction
Reproduction in Astryx Playground
- Open the Playground and enable a Japanese IME.
- Focus the input. The
onEnter callscounter starts at 0. - Type
にほんごand convert it to日本語. - Press Enter once to confirm the conversion.
- Observe that
onEnter callsbecomes 1 even though Enter was used only to confirm the IME conversion. It should remain 0.
The demo keeps the input value and displays a counter and the value captured by each onEnter callback.
Recording:
textinput.mov
Astryx Version
Hosted Astryx Playground (exact deployed package version unknown; also present in main at cde73c7)
Environment
- OS: macOS Tahoe 26.6.2 (25G83)
- Google Chrome 152.0.7977.82 (Official Build), Stable, arm64 — reproduced
- Google Chrome 155.0.8040.2 (Official Build), Dev, arm64 — reproduced
- Safari 26.6.2 (21624.5.1.11.3) — reproduced
- Firefox: could not reproduce in testing (version not recorded)
- Input method: Japanese IME (specific IME name not recorded)