Skip to content

fix(desktop): ignore IME composition Enter shortcuts - #38785

Closed
Yuxin-Qiao wants to merge 1 commit into
NousResearch:mainfrom
Yuxin-Qiao:fix/desktop-ime-composition-enter
Closed

fix(desktop): ignore IME composition Enter shortcuts#38785
Yuxin-Qiao wants to merge 1 commit into
NousResearch:mainfrom
Yuxin-Qiao:fix/desktop-ime-composition-enter

Conversation

@Yuxin-Qiao

Copy link
Copy Markdown

Summary

Fixes Desktop Enter-key handlers so Enter used to commit IME composition does not also trigger submit/save actions.

This is a narrow macOS/CJK input quality fix and does not overlap with the larger Desktop i18n/localization work.

Changes

  • Add isImeComposing() helper for KeyboardEvent.isComposing plus legacy keyCode === 229
  • Apply it to:
    • main chat composer submit path
    • message edit composer submit path
    • onboarding API key / OAuth code inputs
    • session rename input

Why

Chinese/Japanese/Korean IMEs use Enter to commit the current candidate. Without this guard, Hermes Desktop can submit or save while the user is still composing text.

Test plan

  • macOS: enable a Chinese/Japanese/Korean IME
  • In the chat composer, type a preedit string and press Enter to commit candidate; message should remain in the composer
  • Press Enter again after composition ends; message should submit normally
  • Repeat for message edit mode, onboarding code/API-key inputs, and session rename

Fixes #37483

@Yuxin-Qiao
Yuxin-Qiao force-pushed the fix/desktop-ime-composition-enter branch from 64dc7a7 to a5d8697 Compare June 4, 2026 08:34
@Yuxin-Qiao

Copy link
Copy Markdown
Author

Validation update:

  • Added apps/desktop/src/lib/keyboard.test.ts to cover the shared IME helper:
    • isComposing: true is treated as active composition.
    • legacy Chromium/Electron keyCode === 229 is treated as active composition.
    • a plain Enter key press is not treated as composition.
  • Rechecked the affected Enter-submit paths in this PR:
    • main chat composer
    • message edit composer
    • onboarding API key / OAuth code inputs
    • session rename input
  • Ran a local predicate sanity check for the same three helper cases.
  • Rebased the branch onto the current PR base and confirmed GitHub now reports the PR as mergeable (MERGEABLE / BLOCKED, with no conflict state).

I have not run a full Electron/macOS manual IME session in this environment, so the above is code-level validation plus focused helper coverage.

@Yuxin-Qiao

Copy link
Copy Markdown
Author

Closing as superseded by later Desktop composer work and the repository’s newer IME-focused implementations. This branch is now conflicting and thousands of commits behind current main, while the composer has undergone substantial refactoring since this patch. Reworking this exact branch would duplicate active IME efforts; any remaining bug should be addressed from current main with a fresh reproduction.

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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Desktop app: Enter key sends message during IME composition (Japanese, Chinese, Korean, etc.)

2 participants