mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user