From 6fe5a06eeac09eba9b7aed7bdc52db1624f89233 Mon Sep 17 00:00:00 2001 From: acumen7 Date: Wed, 3 Jun 2026 17:49:12 +0800 Subject: [PATCH] fix(desktop): skip Enter submit when Chinese IME is composing The contentEditable keydown handler checked event.key === 'Enter' but did not check event.nativeEvent.isComposing. When a Chinese IME user presses Enter to confirm the current composition candidate, the browser fires a keydown with isComposing=true; the handler treated it as submit and sent the message before the IME could finish. Add isComposing guards to both the trigger-popover Enter/Tab handler and the main Enter-to-submit handler so they return early during IME composition. --- apps/desktop/src/app/chat/composer/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx index aae4827edacc7..291ab66223a25 100644 --- a/apps/desktop/src/app/chat/composer/index.tsx +++ b/apps/desktop/src/app/chat/composer/index.tsx @@ -595,6 +595,7 @@ export function ChatBar({ } if (event.key === 'Enter' || event.key === 'Tab') { + if ((event.nativeEvent as any).isComposing) {return} event.preventDefault() triggerKeyConsumedRef.current = true const item = triggerItems[triggerActive] @@ -615,7 +616,7 @@ export function ChatBar({ } } - if (event.key === 'Enter' && !event.shiftKey) { + if (event.key === 'Enter' && !event.shiftKey && !(event.nativeEvent as any).isComposing) { event.preventDefault() if (!busy && !hasComposerPayload && queuedPrompts.length > 0) { @@ -1082,8 +1083,8 @@ export function ChatBar({