Skip to content

Commit

Permalink
Merge pull request #2814 from xiamiao1121/hotfix/select/#2809
Browse files Browse the repository at this point in the history
 fix(select): 修复搜索时在中文输入法下按回车键弹窗会关闭的问题(#2809)
  • Loading branch information
solarjoker authored May 10, 2024
2 parents 5bacc01 + 99c8d84 commit 428f8d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-keys-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/select": patch
---

fix: 修复搜索时在中文输入法下按回车键弹窗会关闭的问题
5 changes: 5 additions & 0 deletions .changeset/tough-kangaroos-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(select): 修复搜索时在中文输入法下按回车键弹窗会关闭的问题
4 changes: 2 additions & 2 deletions packages/ui/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ export const Select = forwardRef<HTMLDivElement | null, SelectProps>(
const [focusedIndex, setFocusedIndex] = useState<number>(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) {
Expand Down

0 comments on commit 428f8d0

Please sign in to comment.