diff --git a/packages/components/select-v2/src/useSelect.ts b/packages/components/select-v2/src/useSelect.ts index 1d7a6c2175..7fdbb7d00f 100644 --- a/packages/components/select-v2/src/useSelect.ts +++ b/packages/components/select-v2/src/useSelect.ts @@ -698,13 +698,9 @@ const useSelect = (props: ISelectV2Props, emit) => { } } - const handleClickOutside = (event: Event) => { + const handleClickOutside = () => { expanded.value = false - - if (isFocused.value) { - const _event = new FocusEvent('focus', event) - handleBlur(_event) - } + isFocused.value && blur() } const handleMenuEnter = () => { diff --git a/packages/components/select/src/useSelect.ts b/packages/components/select/src/useSelect.ts index afe2c97fa1..90fedae0d7 100644 --- a/packages/components/select/src/useSelect.ts +++ b/packages/components/select/src/useSelect.ts @@ -103,7 +103,7 @@ export const useSelect = (props: ISelectProps, emit) => { afterComposition: (e) => onInput(e), }) - const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, { + const { wrapperRef, isFocused } = useFocusController(inputRef, { beforeFocus() { return selectDisabled.value }, @@ -657,20 +657,16 @@ export const useSelect = (props: ISelectProps, emit) => { } const blur = () => { - handleClickOutside() + inputRef.value?.blur() } const handleClearClick = (event: Event) => { deleteSelected(event) } - const handleClickOutside = (event: Event) => { + const handleClickOutside = () => { expanded.value = false - - if (isFocused.value) { - const _event = new FocusEvent('focus', event) - nextTick(() => handleBlur(_event)) - } + isFocused.value && blur() } const handleEsc = () => {