fix(ui): ignore Enter during IME composition in select dropdowns#9331
fix(ui): ignore Enter during IME composition in select dropdowns#9331greymoth-jp wants to merge 1 commit into
Conversation
MultiSelectDropdown and SingleSelectDropdown pass their Combobox onKeyDown through useDropdownKeyPressed, which calls onEnterKeyDown (toggleDropdown) on every Enter. While filtering with an IME, the Enter that confirms a composition bubbles up from the search input and closes the dropdown. Skip Enter while nativeEvent.isComposing, mirroring the guard already in useDropdownKeyDown.
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesIME Composition Guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Description
MultiSelectDropdownandSingleSelectDropdownattach theirComboboxonKeyDowntouseDropdownKeyPressed, which callsonEnterKeyDown(toggleDropdown) on everyEnter. The search input inside the dropdown only stops propagation forEscape, so theEnterthat confirms an IME composition bubbles up from the input to the combobox and toggles the dropdown closed before anything is selected.For a CJK IME (Japanese, Chinese, Korean), the first
Enteris meant to commit the conversion, not to act on the dropdown. As a result the search field is hard to use with an IME: committing the text closes the menu.The sibling hook
useDropdownKeyDownalready guards against this with!event.nativeEvent.isComposing. This change applies the same guard touseDropdownKeyPressed. Non-IMEEnteris unaffected (isComposingisfalse), so it still toggles as before; only theEnterthat ends a composition is ignored.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
With an IME enabled (for example Japanese):
MultiSelectDropdownorSingleSelectDropdownwith search enabled.Enterto confirm the IME conversion.Without an IME, pressing
Enterstill toggles the dropdown exactly as before.I verified by inspection that this matches the existing
useDropdownKeyDownguard and leaves non-composingEnterunchanged. I don't have a CJK IME configured locally to run the end-to-end flow, so a confirmation from someone who does would be welcome.References
The
!event.nativeEvent.isComposingguard already exists inuseDropdownKeyDown(packages/ui/src/hooks/use-dropdown-key-down.tsx) and in the label create handlers; this bringsuseDropdownKeyPressedin line. IME Enter handling has come up before in Plane (for example #7022).Summary by CodeRabbit