diff --git a/packages/vuetify/src/components/VOverlay/VOverlay.tsx b/packages/vuetify/src/components/VOverlay/VOverlay.tsx index 5acfa5dbf9f..dd257f4aadb 100644 --- a/packages/vuetify/src/components/VOverlay/VOverlay.tsx +++ b/packages/vuetify/src/components/VOverlay/VOverlay.tsx @@ -162,6 +162,7 @@ export const VOverlay = genericComponent()({ }) const root = ref() + const scrimEl = ref() const contentEl = ref() const { contentStyles, updateLocation } = useLocationStrategies(props, { isRtl, @@ -184,8 +185,11 @@ export const VOverlay = genericComponent()({ else animateClick() } - function closeConditional () { - return isActive.value && globalTop.value + function closeConditional (e: Event) { + return isActive.value && globalTop.value && ( + // If using scrim, only close if clicking on it rather than anything opened on top + !props.scrim || e.target === scrimEl.value + ) } IN_BROWSER && watch(isActive, val => { @@ -297,6 +301,7 @@ export const VOverlay = genericComponent()({ ()({ return { activatorEl, + scrimEl, target, animateClick, contentEl,