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 <noreply@anthropic.com>
This commit is contained in:
Yogi
2026-06-28 23:47:02 -05:00
committed by GitHub
co-authored by Yogi Claude Opus 4.8
parent 5922727402
commit 6f5f263244
2 changed files with 12 additions and 0 deletions
@@ -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;
@@ -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}`);