From 6f5f2632442af627bdeb01fdfea4301f4a5a7c95 Mon Sep 17 00:00:00 2001 From: Yogi Date: Mon, 29 Jun 2026 13:47:02 +0900 Subject: [PATCH] fix: ignore IME composition Enter in chat search (#26172) (#26238) Pressing Enter to confirm an IME composition (e.g. Japanese, Chinese, or Korean) in the chat search modal and the sidebar search input was treated as a normal Enter and triggered a search action such as starting a new chat, instead of just confirming the composed text. Guard the search keydown handlers so a keydown fired while composing is ignored: - SearchInput.svelte on:keydown - SearchModal.svelte document-level onKeyDown using e.isComposing (with a keyCode === 229 fallback), mirroring the IME guard already used by MessageInput. A second Enter, after the composition is confirmed, still triggers the action as before. Fixes #26172 Co-authored-by: Yogi <251807336+ybnjm1234-source@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 --- src/lib/components/layout/SearchModal.svelte | 6 ++++++ src/lib/components/layout/Sidebar/SearchInput.svelte | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/lib/components/layout/SearchModal.svelte b/src/lib/components/layout/SearchModal.svelte index 5617de7c22..70942fca91 100644 --- a/src/lib/components/layout/SearchModal.svelte +++ b/src/lib/components/layout/SearchModal.svelte @@ -176,6 +176,12 @@ } const onKeyDown = (e) => { + // Ignore keydown fired while confirming an IME composition (e.g. Japanese/Chinese/Korean) + // so confirming the composition with Enter doesn't trigger search actions (#26172). + if (e.isComposing || e.keyCode === 229) { + return; + } + const searchOptions = document.getElementById('search-options-container'); if (searchOptions || !show) { return; diff --git a/src/lib/components/layout/Sidebar/SearchInput.svelte b/src/lib/components/layout/Sidebar/SearchInput.svelte index f29dc57cca..3e07a1e2d7 100644 --- a/src/lib/components/layout/Sidebar/SearchInput.svelte +++ b/src/lib/components/layout/Sidebar/SearchInput.svelte @@ -229,6 +229,12 @@ } }} on:keydown={(e) => { + // Ignore keydown fired while confirming an IME composition (e.g. Japanese/Chinese/Korean) + // so confirming the composition with Enter doesn't trigger search actions (#26172). + if (e.isComposing || e.keyCode === 229) { + return; + } + if (e.key === 'Enter') { if (filteredItems.length > 0) { const itemElement = document.getElementById(`search-item-${selectedIdx}`);