Skip to content

Fix Enter key submitting message during IME composition#407

Open
aisensiy wants to merge 3 commits into
jupyterlab:mainfrom
aisensiy:fix/ime-composition-enter
Open

Fix Enter key submitting message during IME composition#407
aisensiy wants to merge 3 commits into
jupyterlab:mainfrom
aisensiy:fix/ime-composition-enter

Conversation

@aisensiy

Copy link
Copy Markdown

Description

When using an Input Method Editor (IME) — such as Chinese Pinyin, Japanese, or Korean — pressing Enter to confirm a candidate character incorrectly submits the chat message instead of completing the IME composition.

This adds checks for event.isComposing and event.keyCode === 229 to ignore Enter key events during IME composition in two places:

  • chat-input.tsx — the main chat input
  • multichat-panel.tsx — the chat selector search input

Reproduce

  1. Open a chat in JupyterLab
  2. Switch to a CJK input method (e.g. Chinese Pinyin)
  3. Type jupyter in the chat input — the IME shows a candidate list
  4. Press Enter to confirm the selected candidate
  5. The message is submitted immediately with incomplete/unintended text

Fix

During IME composition, the browser fires keydown events with event.isComposing === true (and event.keyCode === 229 for legacy compatibility). These are now detected and ignored so Enter only sends the message outside of IME composition.

References: MDN: KeyboardEvent.isComposing

When using CJK input methods (Chinese, Japanese, Korean), pressing Enter
to confirm an IME candidate incorrectly submits the chat message. This
adds checks for `event.isComposing` and `event.keyCode === 229` to
ignore Enter key events during IME composition.
@github-actions

Copy link
Copy Markdown
Contributor

Binder 👈 Launch a Binder on branch aisensiy/jupyter-chat/fix%2Fime-composition-enter

@nakul-py nakul-py left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aisensiy
Let comments simple without example.

Comment thread packages/jupyter-chat/src/components/input/chat-input.tsx Outdated
Comment thread packages/jupyter-chat/src/widgets/multichat-panel.tsx Outdated
aisensiy and others added 2 commits April 13, 2026 16:12
Co-authored-by: Nakul Verma <nakulverma.py@gmail.com>
Co-authored-by: Nakul Verma <nakulverma.py@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants