Skip to content

Unintended message sending during IME composition #83

@riya-amemiya

Description

@riya-amemiya

Bug report

Describe the bug

When typing in languages that use Input Method Editors (IMEs) such as Japanese, Chinese, or Korean, pressing the Enter key to confirm the IME conversion unintentionally sends the message. The system doesn't distinguish between normal Enter key presses and those used for IME conversion confirmation.

To Reproduce

Steps to reproduce the behavior:

  1. Open the chat interface
  2. Start typing in a language that uses an IME (e.g., Japanese)
  3. Begin the composition process (e.g., type "こんにちは" in hiragana)
  4. Press Enter to confirm the IME conversion
  5. Observe that the message is sent immediately, even though you were only trying to confirm the IME conversion

Expected behavior

The Enter key press should only confirm the IME conversion without sending the message. The message should only be sent when pressing Enter after the IME composition is complete.

Screenshots

[If applicable, add screenshots here to demonstrate the issue]

System information

  • OS: macOS
  • Browser: Chrome

Additional context

This bug significantly impacts the user experience for users typing in languages that use IMEs. It affects the accessibility and usability of the chat interface for a global audience.

Proposed solution: Add an isComposing check to the keydown event handler to prevent message sending during IME composition. Example code snippet:

onKeyDown={(e) => {
  if (!(e.target instanceof HTMLTextAreaElement)) {
    return
  }

 if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
  // ... rest of the handler

This change would ensure that the Enter key only sends the message when it's not being used for IME composition confirmation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions