Skip to content

Commit 65d0c5f

Browse files
committed
another fix: ensure close on external focus
fixes #20569
1 parent 300693e commit 65d0c5f

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
@@ -127,7 +127,6 @@ export const VMenu = genericComponent<OverlaySlots>()({
127127
await nextTick()
128128

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

144-
document.removeEventListener('pointerdown', onPointerdown)
146+
document.removeEventListener('pointerdown', onPointerdown)
147+
}
145148
}
146149
}
147150

0 commit comments

Comments
 (0)