Skip to content

Fix IME Enter key submission - #459

Draft
zhouzhuozhzh-maker wants to merge 1 commit into
andrewyng:mainfrom
zhouzhuozhzh-maker:codex/fix-ime-enter-submit
Draft

Fix IME Enter key submission#459
zhouzhuozhzh-maker wants to merge 1 commit into
andrewyng:mainfrom
zhouzhuozhzh-maker:codex/fix-ime-enter-submit

Conversation

@zhouzhuozhzh-maker

Copy link
Copy Markdown

What changed

  • Ignore Enter while the composer is handling an active IME composition.
  • Handle WebKit's keyCode === 229 process-key fallback, which can occur after compositionend on macOS.
  • Apply the guard to both normal message submission and slash-command selection.
  • Add regression coverage for active composition, the WebKit fallback, and normal Enter submission.

Why

When a Chinese IME was used to enter English text, pressing Enter to confirm the pending input could also submit the message. WebKit can report isComposing as false by the time React receives that keydown, so checking isComposing alone is insufficient.

Impact

IME confirmation now keeps the draft in the composer. A subsequent normal Enter still sends as expected.

Validation

  • npm test -- --run src/components/Composer.input.test.tsx src/components/Composer.skills.test.tsx (11 tests passed)
  • npm run build

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.

1 participant