Skip to content

Enter key confirming IME composition (e.g. Japanese kanji conversion) sends the chat message prematurely #166

Description

@pecokoba37

Summary

In the Workshop chat composer, pressing Enter to confirm an IME composition
(e.g. converting kana to kanji while typing Japanese, or any other CJK IME)
sends the chat message instead of just confirming the conversion.

Steps to reproduce

  1. Open the Workshop chat.
  2. Switch to a Japanese (or other IME-based) input method.
  3. Type some text and start composing/converting (e.g. typing romaji that
    converts to kana/kanji candidates).
  4. Press Enter to confirm the conversion.

Expected

Enter confirms the IME composition only; the message is not sent.

Actual

The message is sent immediately, often mid-composition, because the
composer's onKeyDown handler doesn't check whether an IME composition is
in progress.

Root cause

ChatInterface.tsx's "Enter sends message" handler checks only
e.key === "Enter" && !e.shiftKey, without checking
e.nativeEvent.isComposing (the standard way to detect an in-progress IME
composition in React's onKeyDown).

Suggested fix

Add an isComposing guard, e.g.:

if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
  e.preventDefault();
  if (!isAgentActive && !isBlocked) submitMessage();
  return;
}

Happy to open a PR with this fix if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions