Clawith
Clawith copied to clipboard
Pressing Enter to confirm IME candidate word on macOS triggers message send simultaneously
Pre-checks
- [x] I have searched existing issues and this is not a duplicate.
Deployment Method
Docker
Steps to Reproduce
- Open any conversation window
- Switch to a Chinese input method (e.g., Simplified Pinyin)
- Type pinyin to bring up the candidate word panel
- Press Enter to select a candidate word
- The message is sent immediately instead of only confirming the input
Expected vs Actual Behavior
- Pressing Enter should only commit the IME composition (candidate word selection), not trigger message send
- Message sending should be triggered by a dedicated shortcut (e.g., Cmd+Enter) or only when the user is not in an IME composition state
Logs / Screenshots
Environment
- OS: macOS (Sonoma / Sequoia)
- Input Method: macOS Built-in Simplified Pinyin / Sogou Pinyin / Other third-party Chinese IMEs
- Reproduce Rate: 100%
Actual Behavior
- The Enter key performs two actions simultaneously: confirming the candidate word AND sending the message
- Users cannot freely edit content while using a Chinese IME — every time they want to type English characters, they must manually switch to an English input method first
Impact
- Severely degrades the daily input experience for Chinese-speaking users
- Forces users to frequently switch between Chinese and English IMEs, adding unnecessary friction
- Particularly painful for scenarios requiring mixed Chinese-English input (e.g., technical discussions)
Suggested Fix
- Check KeyboardEvent.isComposing in the keydown event handler and skip the send logic when the value is true
- Alternatively, change the send shortcut to Cmd+Enter / Ctrl+Enter, and reserve Enter for line breaks and IME confirmation only
Reference
- MDN: KeyboardEvent.isComposing — https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing
- Major products such as Slack, Feishu (Lark), and Notion have all addressed this issue
This is fixed in the current chat input handler.
The message composer now explicitly checks the IME composition state before sending on Enter:
frontend/src/pages/agent-detail/AgentDetailPage.tsx:6480-6485only sends whene.key === 'Enter',!e.shiftKey, and!e.nativeEvent.isComposing.
That means pressing Enter to confirm an IME candidate no longer triggers message send while composition is still active. Closing as completed.