diff options
| author | drunkpiano <[email protected]> | 2026-01-21 03:01:56 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-20 13:01:56 -0600 |
| commit | 156ce54362f1ef18bd40c408e235f47193f92d1e (patch) | |
| tree | 8f7d4e09eef7868c64637675a708c3de3a2fa428 /packages/ui/src | |
| parent | 1bc919dc74771e7a839a5d44ddd6d6afde4f190e (diff) | |
| download | opencode-156ce54362f1ef18bd40c408e235f47193f92d1e.tar.gz opencode-156ce54362f1ef18bd40c408e235f47193f92d1e.zip | |
fix(ui): prevent Enter key action during IME composition (#9564)
Diffstat (limited to 'packages/ui/src')
| -rw-r--r-- | packages/ui/src/components/list.tsx | 2 | ||||
| -rw-r--r-- | packages/ui/src/hooks/use-filtered-list.tsx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/packages/ui/src/components/list.tsx b/packages/ui/src/components/list.tsx index 6929f6b73..2815805ad 100644 --- a/packages/ui/src/components/list.tsx +++ b/packages/ui/src/components/list.tsx @@ -133,7 +133,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void }) const index = selected ? all.indexOf(selected) : -1 props.onKeyEvent?.(e, selected) - if (e.key === "Enter") { + if (e.key === "Enter" && !e.isComposing) { e.preventDefault() if (selected) handleSelect(selected, index) } else { diff --git a/packages/ui/src/hooks/use-filtered-list.tsx b/packages/ui/src/hooks/use-filtered-list.tsx index b8a55000e..8595af529 100644 --- a/packages/ui/src/hooks/use-filtered-list.tsx +++ b/packages/ui/src/hooks/use-filtered-list.tsx @@ -77,7 +77,7 @@ export function useFilteredList<T>(props: FilteredListProps<T>) { } const onKeyDown = (event: KeyboardEvent) => { - if (event.key === "Enter") { + if (event.key === "Enter" && !event.isComposing) { event.preventDefault() const selectedIndex = flat().findIndex((x) => props.key(x) === list.active()) const selected = flat()[selectedIndex] |
