Bug Description
When using Chinese IME (or other CJK input methods) in the chat input, pressing Enter to confirm/select the composed characters instead triggers message submission.
Steps to Reproduce
- Open the Web UI chat
- Activate Chinese IME (e.g., Pinyin, Wubi)
- Type pinyin characters (e.g., "ni hao")
- Press Enter to confirm the Chinese characters
- Instead of confirming the input, the message is sent immediately
Root Cause
In packages/web/src/components/chat-room/chat-composer.tsx, the handleKeyDown function checks for Enter key but does not account for IME composition state:
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
onSubmit();
}
There is no check for event.nativeEvent.isComposing. During IME composition, Enter is used to confirm/select characters, not to submit the message.
Expected Behavior
Pressing Enter during IME composition should confirm the input, not send the message. Only press Enter when isComposing === false should trigger submission.
Fix
Add a guard for the composition state:
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
event.preventDefault();
onSubmit();
}
Bug Description
When using Chinese IME (or other CJK input methods) in the chat input, pressing Enter to confirm/select the composed characters instead triggers message submission.
Steps to Reproduce
Root Cause
In
packages/web/src/components/chat-room/chat-composer.tsx, thehandleKeyDownfunction checks for Enter key but does not account for IME composition state:There is no check for
event.nativeEvent.isComposing. During IME composition, Enter is used to confirm/select characters, not to submit the message.Expected Behavior
Pressing Enter during IME composition should confirm the input, not send the message. Only press Enter when
isComposing === falseshould trigger submission.Fix
Add a guard for the composition state: