From 6a35c4a86a44bdf81d4035779a71f08e715bec33 Mon Sep 17 00:00:00 2001 From: Bury Huang Date: Sat, 11 Apr 2026 22:46:58 -0700 Subject: [PATCH] fix: prevent Enter from sending message during IME composition When typing Chinese, Japanese, or Korean using an IME, pressing Enter to confirm a character selection was incorrectly triggering message send. Added isComposing guard to all chat input keydown handlers. --- packages/go/components/chat/chat-input.tsx | 3 +++ sdk/studio/src/pages/messaging/components/MessageInput.tsx | 3 +++ workspace/frontend/components/chat/chat-input.tsx | 3 +++ 3 files changed, 9 insertions(+) diff --git a/packages/go/components/chat/chat-input.tsx b/packages/go/components/chat/chat-input.tsx index 42727361c..c7731b1ef 100644 --- a/packages/go/components/chat/chat-input.tsx +++ b/packages/go/components/chat/chat-input.tsx @@ -135,6 +135,9 @@ export function ChatInput({ onSend, disabled, className, agents = [], draft, onD }; const handleKeyDown = (e: React.KeyboardEvent) => { + // Ignore Enter during IME composition (Chinese, Japanese, Korean input) + if (e.nativeEvent.isComposing || e.key === 'Process') return; + if (showMentions && filteredAgents.length > 0) { if (e.key === 'ArrowDown') { e.preventDefault(); diff --git a/sdk/studio/src/pages/messaging/components/MessageInput.tsx b/sdk/studio/src/pages/messaging/components/MessageInput.tsx index 04e1b6d16..4847271ec 100644 --- a/sdk/studio/src/pages/messaging/components/MessageInput.tsx +++ b/sdk/studio/src/pages/messaging/components/MessageInput.tsx @@ -715,6 +715,9 @@ const MessageInput: React.FC = ({ } const handleKeyDown = (e: React.KeyboardEvent) => { + // Ignore Enter during IME composition (Chinese, Japanese, Korean input) + if (e.nativeEvent.isComposing || e.key === 'Process') return; + // Handle mention navigation if (showMentions && filteredAgents.length > 0) { if (e.key === "ArrowDown") { diff --git a/workspace/frontend/components/chat/chat-input.tsx b/workspace/frontend/components/chat/chat-input.tsx index 42727361c..c7731b1ef 100644 --- a/workspace/frontend/components/chat/chat-input.tsx +++ b/workspace/frontend/components/chat/chat-input.tsx @@ -135,6 +135,9 @@ export function ChatInput({ onSend, disabled, className, agents = [], draft, onD }; const handleKeyDown = (e: React.KeyboardEvent) => { + // Ignore Enter during IME composition (Chinese, Japanese, Korean input) + if (e.nativeEvent.isComposing || e.key === 'Process') return; + if (showMentions && filteredAgents.length > 0) { if (e.key === 'ArrowDown') { e.preventDefault();