From 99c8d84a500a6a857adb1921addb4b278b255168 Mon Sep 17 00:00:00 2001 From: xiamiao Date: Thu, 9 May 2024 11:32:51 +0800 Subject: [PATCH] =?UTF-8?q?chore(select):=20=E4=BB=A3=E7=A0=81=E7=AE=80?= =?UTF-8?q?=E5=8C=96(#2809)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/select/src/Select.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/ui/select/src/Select.tsx b/packages/ui/select/src/Select.tsx index de4d8ac00..94f355e96 100644 --- a/packages/ui/select/src/Select.tsx +++ b/packages/ui/select/src/Select.tsx @@ -186,12 +186,11 @@ export const Select = forwardRef( const defaultIndex = showData.findIndex((item: SelectDataItem) => !item.disabled) const [focusedIndex, setFocusedIndex] = useState(defaultIndex) - const [isComposing, setIsComposing] = useState(false) const handleKeyDown = useLatestCallback((evt: React.KeyboardEvent) => { - const { key } = evt + const { keyCode } = evt - if (key === 'Enter' && !isComposing) { + if (keyCode === 13) { const item = showData[focusedIndex] if (item) { @@ -236,12 +235,6 @@ export const Select = forwardRef( onKeyDown={mockDefaultHandlers(handleKeyDown, onKeyDownProp)} onOpen={menuVisibleAction.on} onClose={menuVisibleAction.off} - onCompositionStart={() => { - setIsComposing(true) - }} - onCompositionEnd={() => { - setIsComposing(false) - }} searchable={searchable} keyword={keywordProp} onSearch={callAllFuncs(onSearchProp, onSearch)}