Skip to content

Commit 0030e5d

Browse files
committed
another fix: ensure close on external focus
fixes #20569
1 parent 6d07867 commit 0030e5d

File tree

1 file changed

+7
-4
lines changed
  • packages/vuetify/src/components/VMenu

1 file changed

+7
-4
lines changed

packages/vuetify/src/components/VMenu/VMenu.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ export const VMenu = genericComponent<OverlaySlots>()({
126126
await nextTick()
127127

128128
if (
129-
!focusTrapSuppressed &&
130129
isActive.value &&
131130
before !== after &&
132131
overlay.value?.contentEl &&
@@ -137,10 +136,14 @@ export const VMenu = genericComponent<OverlaySlots>()({
137136
// It isn't inside the menu body
138137
!overlay.value.contentEl.contains(after)
139138
) {
140-
const focusable = focusableChildren(overlay.value.contentEl)
141-
focusable[0]?.focus()
139+
if (focusTrapSuppressed) {
140+
isActive.value = false
141+
} else {
142+
const focusable = focusableChildren(overlay.value.contentEl)
143+
focusable[0]?.focus()
142144

143-
document.removeEventListener('pointerdown', onPointerdown)
145+
document.removeEventListener('pointerdown', onPointerdown)
146+
}
144147
}
145148
}
146149

0 commit comments

Comments
 (0)