Repository navigation
Don't send the chat message on an IME composition Enter - #280
Merged
Merged
Conversation
Committing a composition presses Enter, and the browser delivers that as an ordinary keydown, so the first Enter of every Japanese, Chinese or Korean sentence sent the message half-typed. The same keydown also reaches the slash-command picker, where Escape and the arrow keys belong to the IME's candidate list rather than the picker. Return early while a composition is in flight, which hands the whole keystroke back to the IME. `isComposing` lives on the native event; React's synthetic KeyboardEvent does not re-expose it.
Member
|
Thanks @kochizufan! |
tosaka07
added a commit
to tosaka07/cloudflare-os
that referenced
this pull request
Aug 21, 2026
* upstream/main: Seed Linear and Spotify OAuth creds in local dev (cloudflare#90) add IME composition guards across the board (cloudflare#291) follow-up fixes from cloudflare#274 (cloudflare#290) Don't send the chat message on an IME composition Enter (cloudflare#280) Lay the foundation for a Google Drive gatekeeper (cloudflare#286) fix gatekeeper connection modal on mobile (cloudflare#289) make context collection settings visible on mobile (cloudflare#288) fix modal presentation for embedded gatekeeper UI (cloudflare#287) Frontend reconnect hardening: tab wake & reconnect probe (cloudflare#172) store context files as byte arrays instead of JS strings (cloudflare#274) Pin @cloudflare/* to the public registry, and move CI onto setup-vp (cloudflare#283) Make the Workshop UI fully responsive on phones (cloudflare#284)
darjss
pushed a commit
to darjss/cloudflare-os-erxes
that referenced
this pull request
Aug 26, 2026
Committing a composition presses Enter, and the browser delivers that as an ordinary keydown, so the first Enter of every Japanese, Chinese or Korean sentence sent the message half-typed. The same keydown also reaches the slash-command picker, where Escape and the arrow keys belong to the IME's candidate list rather than the picker. Return early while a composition is in flight, which hands the whole keystroke back to the IME. `isComposing` lives on the native event; React's synthetic KeyboardEvent does not re-expose it.
gmackie
pushed a commit
to gmackie/educate-os
that referenced
this pull request
Nov 2, 2026
…strict Worker' (cloudflare#280) from SCHO-179-launch-wiring into main
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
The chat textarea treats every un-shifted Enter as "send". An IME commits a composition with Enter, and the browser delivers that as an ordinary
keydown, so the first Enter of a Japanese, Chinese or Korean sentence sends the message half-typed. Reproducing it needs only an IME: type かんじ, press Enter to pick the conversion, and the partial message is already on its way.The same handler drives the slash-command picker, where Escape cancels a composition and the arrow keys walk the IME's candidate list — both are currently taken from the IME.
This returns early from the handler while a composition is in flight, handing the whole keystroke back to the IME.
Why is this obviously correct and trivially verifiable?
isComposingis true only betweencompositionstartandcompositionend. Outside a composition — which is every keystroke for anyone not typing through an IME — it is false, the guard falls through, and the handler below runs exactly as before. So the patch cannot change behaviour for existing users; the only difference is that keydowns delivered mid-composition no longer reach the handlers underneath.Six added lines in one file. No new state, no new props, no API change. The property lives on the native event because React's synthetic
KeyboardEventdoes not re-expose it.Verified against a deployment: composition Enter no longer sends, ordinary Enter still sends, Shift+Enter still breaks the line, and the slash-command picker's Enter, arrows and Escape are unchanged when no IME is involved.
Checklist
Checking every item does not guarantee acceptance. Maintainers determine whether
a pull request meets the contribution policy.
There are ~24 other
key === 'Enter'handlers in the frontend (renames, share dialogs, the command palette) with the same defect. I kept this to the chat input, where the damage is unrecoverable, rather than exceed the size the guidelines ask for. Happy to open a discussion about the rest.