fix: avoid selecting active option when Enter confirms IME composition#1236
fix: avoid selecting active option when Enter confirms IME composition#1236greymoth-jp wants to merge 1 commit into
Conversation
|
@greymoth-jp is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
When the dropdown is open in a searchable Select, the keydown handler in
BaseSelectforwards Enter to the option list and selects the active option wheneverkey === 'Enter', without checking whether that Enter is confirming an IME composition.So when a user types CJK text (Japanese/Chinese/Korean), the first option is highlighted by
defaultActiveFirstOption, and the Enter the user presses to confirm the IME conversion selects that highlighted option before they have finished composing.Selectoralready guards this for the tags-mode submit with!compositionStatusRef.current, but the option-selection path inBaseSelectwas missing the equivalent check.This shows up on browsers where the Enter that confirms the composition still reports
keyCode === 13, the same case theSelectoralready handles for tags mode. In Chrome the option list'swhichswitch misses it (keyCode is229there), butisComposingis set in every browser, so it is the reliable thing to check.Fix: skip the option-list keydown when the Enter is confirming a composition (
event.nativeEvent.isComposing).Added
tests/Composition.test.tsx: a composing Enter no longer firesonChange/onSelect, while a normal Enter still selects the active option. Full suite stays green.