diff --git a/.changeset/real-keys-check.md b/.changeset/real-keys-check.md new file mode 100644 index 000000000..c33995b8c --- /dev/null +++ b/.changeset/real-keys-check.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/select": patch +--- + +fix: 修复搜索时在中文输入法下按回车键弹窗会关闭的问题 diff --git a/.changeset/tough-kangaroos-beam.md b/.changeset/tough-kangaroos-beam.md new file mode 100644 index 000000000..db7cba9d7 --- /dev/null +++ b/.changeset/tough-kangaroos-beam.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +fix(select): 修复搜索时在中文输入法下按回车键弹窗会关闭的问题 diff --git a/packages/ui/select/src/Select.tsx b/packages/ui/select/src/Select.tsx index 1e5379334..94f355e96 100644 --- a/packages/ui/select/src/Select.tsx +++ b/packages/ui/select/src/Select.tsx @@ -188,9 +188,9 @@ export const Select = forwardRef( const [focusedIndex, setFocusedIndex] = useState(defaultIndex) const handleKeyDown = useLatestCallback((evt: React.KeyboardEvent) => { - const { key } = evt + const { keyCode } = evt - if (key === 'Enter') { + if (keyCode === 13) { const item = showData[focusedIndex] if (item) {