-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Bug report
Describe the bug
When typing in languages that use Input Method Editors (IMEs) such as Japanese, Chinese, or Korean, pressing the Enter key to confirm the IME conversion unintentionally sends the message. The system doesn't distinguish between normal Enter key presses and those used for IME conversion confirmation.
To Reproduce
Steps to reproduce the behavior:
- Open the chat interface
- Start typing in a language that uses an IME (e.g., Japanese)
- Begin the composition process (e.g., type "こんにちは" in hiragana)
- Press Enter to confirm the IME conversion
- Observe that the message is sent immediately, even though you were only trying to confirm the IME conversion
Expected behavior
The Enter key press should only confirm the IME conversion without sending the message. The message should only be sent when pressing Enter after the IME composition is complete.
Screenshots
[If applicable, add screenshots here to demonstrate the issue]
System information
- OS: macOS
- Browser: Chrome
Additional context
This bug significantly impacts the user experience for users typing in languages that use IMEs. It affects the accessibility and usability of the chat interface for a global audience.
Proposed solution: Add an isComposing check to the keydown event handler to prevent message sending during IME composition. Example code snippet:
onKeyDown={(e) => {
if (!(e.target instanceof HTMLTextAreaElement)) {
return
}
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
// ... rest of the handlerThis change would ensure that the Enter key only sends the message when it's not being used for IME composition confirmation.