fix(components): [autocomplete] reset ignoreFocusEvent on outside click (#23513)

* fix(components): [autocomplete] reset ignoreFocusEvent on outside click

* Update autocomplete.vue

* Update autocomplete.vue

* Update autocomplete.vue

* Update autocomplete.vue
This commit is contained in:
E66
2026-02-18 04:36:39 +08:00
committed by GitHub
parent 0192470da6
commit fdea0ddff0

View File

@@ -397,10 +397,17 @@ const getSuggestionContext = () => {
return [suggestion, suggestionList] as const
}
const stopHandle = onClickOutside(listboxRef, () => {
const stopHandle = onClickOutside(listboxRef, (event: FocusEvent) => {
// Prevent closing if focus is inside popper content
if (popperRef.value?.isFocusInsideContent()) return
suggestionVisible.value && close()
const hadIgnoredFocus = ignoreFocusEvent
ignoreFocusEvent = false
if (!suggestionVisible.value) return
if (hadIgnoredFocus) {
handleBlur(new FocusEvent('blur', event))
} else {
close()
}
})
const handleKeydown = (e: KeyboardEvent | Event) => {