fix(desktop): prevent Enter from submitting during IME composition - #37487
fix(desktop): prevent Enter from submitting during IME composition#37487satotakumi wants to merge 1 commit into
Conversation
Check event.nativeEvent.isComposing in Enter-to-submit branches so CJK (Japanese, Chinese, Korean) and other compositional input methods commit the candidate instead of firing the send handler. Applied to all five sites in the desktop renderer that currently handle Enter with no composition guard: - chat composer main submit and trigger popover (apps/desktop/src/app/chat/composer/index.tsx) - message edit composer submit and trigger popover (apps/desktop/src/components/assistant-ui/thread.tsx) - onboarding API key and auth code inputs (apps/desktop/src/components/desktop-onboarding-overlay.tsx) - session rename input (apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx) Fixes NousResearch#37483
combatsheep
left a comment
There was a problem hiding this comment.
Reviewed the IME-composition guards across composer, edit, onboarding, and rename flows. The native check is applied consistently at every Enter/Tab submit path and the scope matches the reported bug. Approving.
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean IME composition guard fix. Adds !event.nativeEvent.isComposing checks to Enter/Tab key handlers across 4 files (composer, session-actions, thread, onboarding). Standard pattern used throughout the web ecosystem. +7/-7 lines — minimal, targeted, correct.
Reviewed by Hermes Agent
|
Thanks for the focused IME fix. The primary chat-composer behavior is already covered on current main, but the same bug class remains in refactored sibling paths. Problems
Suggested changes
Automated hermes-sweeper review. |
|
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. |
What does this PR do?
Prevents the desktop app's Enter-to-submit branches from firing while an IME composition is active. Users typing in Japanese, Chinese, Korean, Vietnamese, or any other compositional input method were seeing their messages sent mid-conversion instead of committing the candidate.
The fix is a single
!event.nativeEvent.isComposingguard added to every Enter handler in the desktop renderer that previously had none.This is the right approach because:
event.nativeEvent.isComposingis the standard Chromium signal for active IME composition, exposed as a property on everyKeyboardEventregardless of IME implementation.isComposing) is safer across Electron's bundled Chromium versions.Related Issue
Fixes #37483
Type of Change
Changes Made
Added
!event.nativeEvent.isComposingto the following Enter handlers:apps/desktop/src/app/chat/composer/index.tsx— main composer submit (L592) and/@trigger popover (L573)apps/desktop/src/components/assistant-ui/thread.tsx— message edit submit (L1239) and trigger popover (L1213)apps/desktop/src/components/desktop-onboarding-overlay.tsx— API key input (L486) and auth code input (L554)apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx— session rename input (L227)Each file is a one-line change; total diff is 4 files, 7 insertions, 7 deletions.
How to Test
Reproduction (before fix):
きょうは(pre-conversion kana) in the chat composer.Verification (after fix):
Additional verification targets:
/and@trigger popovers still close on Enter/Tab and commit on click when composing is not active.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — N/A (no Desktop-specific Python tests exist; Desktop is pure TypeScript/Electron)KeyboardEvent.isComposingreliably (it's a native Chromium property set by the IME subsystem), so a jsdom unit test here would not catch the real-world failure. Manual IME verification was preferred; I'm happy to add a jsdom test if maintainers want one.Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A (this is a bug fix, not a new skill).
Screenshots / Logs
Not applicable. This is a pure input-handling fix — no visual change. The difference is observable only with an IME active and is verified by the behavioural steps in "How to Test" above.
Additional reviewer notes
isComposingis a standardKeyboardEventproperty in Chromium, WebKit, and Firefox — Windows, Linux, and macOS all behave identically here. The fix doesn't introduce any platform-specific code.