diff --git a/packages/components/popper/src/content.vue b/packages/components/popper/src/content.vue index 10e4ad519f..16cd10e3c5 100644 --- a/packages/components/popper/src/content.vue +++ b/packages/components/popper/src/content.vue @@ -151,13 +151,13 @@ const onFocusAfterReleased = () => { const onFocusInTrap = (event: FocusEvent) => { if (props.visible && !trapped.value) { - if (event.relatedTarget) { - ;(event.relatedTarget as HTMLElement)?.focus() - } if (event.target) { focusStartRef.value = event.target as typeof focusStartRef.value } trapped.value = true + if (event.relatedTarget) { + ;(event.relatedTarget as HTMLElement)?.focus() + } } }