From 11fb09e4f40aabab579adfe417f19426b993d628 Mon Sep 17 00:00:00 2001 From: Yuki MIZUNO Date: Sat, 13 Jun 2026 22:48:19 +0900 Subject: [PATCH] Fix (beta): don't send chat message on Enter while composing with IME (CJK) (#12999) Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com> --- .../app/components/chat/chat/chat.component.spec.ts | 10 ++++++++++ src-ui/src/app/components/chat/chat/chat.component.ts | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/chat/chat/chat.component.spec.ts b/src-ui/src/app/components/chat/chat/chat.component.spec.ts index a35117dc5..f7c4134b2 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.spec.ts +++ b/src-ui/src/app/components/chat/chat/chat.component.spec.ts @@ -188,4 +188,14 @@ describe('ChatComponent', () => { component.searchInputKeyDown(event) expect(component.sendMessage).toHaveBeenCalled() }) + + it('should not send message on Enter key press while composing with IME', () => { + jest.spyOn(component, 'sendMessage') + const event = new KeyboardEvent('keydown', { + key: 'Enter', + isComposing: true, + }) + component.searchInputKeyDown(event) + expect(component.sendMessage).not.toHaveBeenCalled() + }) }) diff --git a/src-ui/src/app/components/chat/chat/chat.component.ts b/src-ui/src/app/components/chat/chat/chat.component.ts index ca17d4825..0920af027 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.ts +++ b/src-ui/src/app/components/chat/chat/chat.component.ts @@ -155,7 +155,10 @@ export class ChatComponent implements OnInit { } public searchInputKeyDown(event: KeyboardEvent) { - if (event.key === 'Enter') { + if ( + event.key === 'Enter' && + !(event.isComposing || event.keyCode === 229) + ) { event.preventDefault() this.sendMessage() }