fix: ignore the Enter that confirms an IME composition when selecting a mention#325
fix: ignore the Enter that confirms an IME composition when selecting a mention#325greymoth-jp wants to merge 1 commit into
Conversation
… a mention On browsers that report the IME commit keydown as `which === ENTER` with `isComposing` true (Safari being the common one), pressing Enter to confirm a composed CJK mention selected the highlighted option instead of committing the text. Guard the Enter branch in onInternalKeyDown with event.nativeEvent.isComposing so a composing Enter falls through to the IME.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
@greymoth-jp is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough在 ChangesIME 组合输入 Enter 键守卫
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 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 |
When the suggestion dropdown is open and an option is highlighted, pressing Enter selects it. On browsers that report the IME commit keydown as
which === ENTERwhileisComposingis true (Safari is the common case), the Enter that only confirms an IME composition gets treated as a selection. So while typing a Chinese or Japanese name after the trigger, confirming the conversion replaces the composed text with the highlighted option instead of just committing what was typed.This guards the Enter branch in
onInternalKeyDownwithevent.nativeEvent.isComposing. A composing Enter now returns early and leaves the IME to commit the text, while a real Enter still selects the option. rc-select already ignores Enter while composing in its input, so this brings Mentions in line.Tests cover both cases: a composing Enter does not select, and a normal Enter still selects.
Summary by CodeRabbit
Bug Fixes
Tests