Repository: element-plus/element-plus
File: packages/components/autocomplete/src/autocomplete.vue (Vue)

Code before:
    suggestion.scrollTop = offsetTop
  }
  highlightedIndex.value = index
  inputRef.value?.ref?.setAttribute(
    'aria-activedescendant',
    `${listboxId.value}-item-${highlightedIndex.value}`
  )
}
const getSuggestionContext = () => {
  const suggestion = regionRef.value!.querySelector(
    `.${ns.be('suggestion', 'wrap')}`
  )!
  const suggestionList = suggestion.querySelectorAll<HTMLElement>(
    `.${ns.be('suggestion', 'list')} li`
  )
  return [suggestion, suggestionList] as const
}

const stopHandle = onClickOutside(listboxRef, () => {
  // Prevent closing if focus is inside popper content
  if (popperRef.value?.isFocusInsideContent()) return
  if (suggestionVisible.value) {
    ignoreFocusEvent = false
    close()
  }
})

const handleKeydown = (e: KeyboardEvent | Event) => {
  const code = getEventCode(e as KeyboardEvent)
  switch (code) {
    case EVENT_CODE.up:
      e.preventDefault()
      highlight(highlightedIndex.value - 1)
      break
    case EVENT_CODE.down:
      e.preventDefault()
      highlight(highlightedIndex.value + 1)
      break
    case EVENT_CODE.enter:
    case EVENT_CODE.numpadEnter:
      e.preventDefault()
      handleKeyEnter()
      break
    case EVENT_CODE.tab:
      close()
      break
    case EVENT_CODE.esc:
      handleKeyEscape(e)
      break
    case EVENT_CODE.home:
      e.preventDefault()

Review comment (suggestion):
After carefully reviewing the related fix PRs, I think we may still need to manually trigger the blur event.

Starting from #19522, clicking on the edge of the dropdown menu or its scrollbar no longer hides the dropdown. 
As a result, when the dropdown is later closed by clicking outside, the blur event is not triggered.

Reproduction steps:

1. Show the dropdown
2. Click on the edge of the dropdown or the scrollbar
3. Focus moves from the input to the dropdown content
4. Click outside to close the dropdown
5. blur is not triggered again

Code after:
    suggestion.scrollTop = offsetTop
  }
  highlightedIndex.value = index
  inputRef.value?.ref?.setAttribute(
    'aria-activedescendant',
    `${listboxId.value}-item-${highlightedIndex.value}`
  )
}
const getSuggestionContext = () => {
  const suggestion = regionRef.value!.querySelector(
    `.${ns.be('suggestion', 'wrap')}`
  )!
  const suggestionList = suggestion.querySelectorAll<HTMLElement>(
    `.${ns.be('suggestion', 'list')} li`
  )
  return [suggestion, suggestionList] as const
}

const stopHandle = onClickOutside(listboxRef, (event: FocusEvent) => {
  // Prevent closing if focus is inside popper content
  if (popperRef.value?.isFocusInsideContent()) return
  const hadIgnoredFocus = ignoreFocusEvent
  ignoreFocusEvent = false
  if (!suggestionVisible.value) return
  if (hadIgnoredFocus) {
    handleBlur(new FocusEvent('blur', event))
  } else {
    close()
  }
})

const handleKeydown = (e: KeyboardEvent | Event) => {
  const code = getEventCode(e as KeyboardEvent)
  switch (code) {
    case EVENT_CODE.up:
      e.preventDefault()
      highlight(highlightedIndex.value - 1)
      break
    case EVENT_CODE.down:
      e.preventDefault()
      highlight(highlightedIndex.value + 1)
      break
    case EVENT_CODE.enter:
    case EVENT_CODE.numpadEnter:
      e.preventDefault()
      handleKeyEnter()
      break
    case EVENT_CODE.tab:
      close()
      break
    case EVENT_CODE.esc: