Skip to content

fix: Enter submits during Japanese/CJK IME composition#99

Merged
wmeddie merged 1 commit intomainfrom
fix/japanese-ime-submit
Apr 20, 2026
Merged

fix: Enter submits during Japanese/CJK IME composition#99
wmeddie merged 1 commit intomainfrom
fix/japanese-ime-submit

Conversation

@wmeddie
Copy link
Copy Markdown
Member

@wmeddie wmeddie commented Apr 20, 2026

Summary

  • Pressing Enter during Japanese (and other CJK) IME composition was sending the message / triggering the input's action instead of confirming the IME candidate.
  • Root cause: on macOS's built-in Japanese IME, the Enter keydown that confirms a candidate can fire after compositionend with e.isComposing === false and e.keyCode === 13, so guarding only on e.isComposing or keyCode === 229 is insufficient.
  • Fix: every Enter-to-submit input now tracks composition via oncompositionstart / oncompositionend, with the flag cleared via setTimeout(..., 0) so the confirming Enter keydown that may follow still sees composition as active.

Scope

  • Chat / message inputs (full pattern): homepage, conversation page, task page.
  • Other Enter-triggered inputs (full pattern): agent memory search, global memory search, agent tool catalog search, agent task title, workspace volume mount, setup workspace folder.
  • VariablePopup only receives a KeyboardEvent from its parent, so it gets the lighter !e.isComposing && keyCode !== 229 check rather than local state.

Test plan

  • svelte-check clean (0 errors)
  • Tested in the Tauri desktop app with the macOS built-in Japanese IME — typing hiragana and pressing Enter to confirm a candidate no longer sends the message; a second Enter still sends as expected.
  • Regression: Shift+Enter still inserts a newline in chat inputs; plain Enter still sends when not composing.
  • Re-verify on other IMEs if available (Chinese / Korean).

Track IME composition state via compositionstart/compositionend on
every Enter-to-submit input and block submission while composing.

On macOS built-in Japanese IME, the Enter keydown that confirms an
IME candidate can fire after compositionend with e.isComposing === false
and e.keyCode === 13, so checking e.isComposing alone is insufficient —
Enter confirming the candidate was sending the message.

Chat/message inputs (homepage, conversation, task) and other
Enter-triggered fields (search, task title, workspace folder, volume
mount) use a composing flag set on compositionstart and cleared via
setTimeout(..., 0) on compositionend, so the confirm-Enter keydown that
may follow still sees the flag set. VariablePopup only receives a
KeyboardEvent from its parent, so it gets the lighter keyCode !== 229
check.
@wmeddie wmeddie merged commit 91e52f5 into main Apr 20, 2026
4 checks passed
@wmeddie wmeddie deleted the fix/japanese-ime-submit branch April 20, 2026 09:41
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