Skip to content

Fix Enter during IME composition sending the message - #73

Closed
kote2kote wants to merge 1 commit into
cloudflare:mainfrom
kote2kote:fix-ime-composition-enter
Closed

Fix Enter during IME composition sending the message#73
kote2kote wants to merge 1 commit into
cloudflare:mainfrom
kote2kote:fix-ime-composition-enter

Conversation

@kote2kote

Copy link
Copy Markdown

Problem

When typing with an IME (Japanese, Chinese, Korean input methods), pressing Enter to confirm a text conversion is interpreted as a send action. This makes the chat input nearly unusable for CJK users: every conversion confirmation sends a half-written message.

Fix

Guard the onKeyDown handlers with the standard IME check:

if (e.nativeEvent.isComposing || e.keyCode === 229) return;

keyCode === 229 covers browsers (notably Safari) that fire the confirming keydown without isComposing set.

Applied to the three text inputs in ChatInterface.tsx that submit on Enter:

  • the main chat message input
  • the chat list rename input
  • the chat title edit input

Testing

  • With a Japanese IME: type text, press Enter to confirm the conversion → message is not sent; press Enter again → message sends.
  • Without an IME: Enter sends, Shift+Enter inserts a newline, slash-command picker Enter/Tab/arrow behavior unchanged (the guard returns before those branches only during active composition).
  • tsc --noEmit passes in packages/workshop-frontend.

🤖 Generated with Claude Code

When typing with an IME (Japanese, Chinese, Korean), pressing Enter to
confirm a conversion was treated as a send/submit. Guard the keydown
handlers of the chat input, chat list rename input, and chat title input
with isComposing (plus keyCode 229 for browsers that fire the confirming
keydown without isComposing set).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@kote2kote

kote2kote commented Aug 7, 2026

Copy link
Copy Markdown
Author

After opening this I noticed #31 addresses the same IME composition bug in the chat composer and was submitted first — apologies for the overlap.

For the maintainers, the differences in this PR:

  • It includes the keyCode === 229 fallback for the Safari/WebKit event-ordering case raised in this comment on #31 (WebKit bug 165004), where compositionend can fire before the confirming Enter keydown so isComposing is already false.
  • It applies the same guard to two other Enter-submitting inputs with the same bug: the chat list rename input and the chat title edit input.

Happy to defer to #31 and close this one if you'd prefer to land that first — either way, whichever base you pick, the 229 fallback and the two extra inputs are probably worth including. Your call.

@kote2kote

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 7, 2026
@ndisidore

Copy link
Copy Markdown
Contributor

/bonk review this

@kentonv

kentonv commented Aug 7, 2026

Copy link
Copy Markdown
Member

Hi @kote2kote,

Apologies but, per our contributing guide, we prefer not to receive external pull requests. We prefer instead to receive issue reports, which we can then direct our own agents to solve. Could you please file an issue instead?

@kentonv kentonv closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants