fix(chat): ignore Enter key while IME is composing - #31
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
I can confirm that this issue is reproducible on macOS with Arc Browser when using a Japanese IME. Pressing Enter to confirm the current conversion submits the message unexpectedly. Japanese users are looking forward to seeing this fix merged. Thank you for working on it! |
|
Thanks for working on this — I reproduced the same Japanese IME issue and found one Safari/WebKit edge case that may be worth covering before merge. WebKit bug 165004 documents that Safari can dispatch It may also be safer to put the IME guard at the very start of I implemented and tested that variant here: yusugomori@be546a9. It covers active I won't open a duplicate PR; please feel free to incorporate any of that implementation or its tests into this one. |
|
Thank you for this fix — I hit the same bug with a Japanese IME and didn't spot this PR before opening #73, which overlaps with it. One thing from #73 that may be useful here regardless of which PR lands: it adds the |
|
Hi @Hodokami, Apologies but, per our contributing guide, we prefer not to receive external pull requests. We prefer instead to receive issue reports, which we can then direct our own agents to solve. Could you please file an issue instead? |
Summary
I noticed this while using Cloudflare OS with a Japanese IME.
The chat composer sent a message on every unmodified Enter press, including the Enter key used to confirm an IME composition. This caused accidental sends while the user was still converting text.
Change
Track the IME composition state using
compositionstartandcompositionendon the composer textarea, and ignore Enterkeydownevents whileisComposingis true. Also checkevent.nativeEvent.isComposingfor environments where the compositionend/event ordering differs.Verification
pnpm lintpassespnpm buildpassespnpm testpasses