Skip to content

fix(desktop): block Enter keyCode 229 after IME compositionend - #41026

Closed
leeclouddragon wants to merge 1 commit into
NousResearch:mainfrom
leeclouddragon:fix/desktop-chinese-ime-enter
Closed

leeclouddragon wants to merge 1 commit into
NousResearch:mainfrom
leeclouddragon:fix/desktop-chinese-ime-enter

Conversation

@leeclouddragon

@leeclouddragon leeclouddragon commented Jun 7, 2026

Copy link
Copy Markdown

macOS Chinese IME (and some 3rd-party Windows IMEs) emit Enter with keyCode 229 (legacy VK_PROCESSKEY) after compositionend, while isComposing is already false. The existing guard only checked isComposing and the composingRef, so this Enter slipped through and submitted the message before the committed text was fully in the DOM.

Add an explicit keyCode 229 check in handleEditorKeyDown. keyCode is deprecated, but it is the only reliable signal for this IME commit Enter on Chromium-based browsers. Includes a dom-repro test that simulates the macOS IME sequence.

This complements #37487 by covering the keyCode 229 case that isComposing alone misses.

Fixes: "中文混英文按 Enter 直接上屏"

macOS Chinese IME (and some 3rd-party Windows IMEs) emit Enter with
keyCode 229 (legacy VK_PROCESSKEY) after compositionend, while
isComposing is already false. The existing guard only checked
isComposing and the composingRef, so this Enter slipped through and
submitted the message before the committed text was fully in the DOM.

Add an explicit keyCode 229 check in handleEditorKeyDown.  keyCode is
deprecated, but it is the only reliable signal for this IME commit
Enter on Chromium-based browsers.  Includes a dom-repro test that
simulates the macOS IME sequence.

Fixes: "中文混英文按 Enter 直接上屏"
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for this fix! It was salvaged into #86760 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing since the work has landed.

@teknium1 teknium1 closed this Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants