From cbb945d68086044f04cb13ef245dc4b4cb732392 Mon Sep 17 00:00:00 2001 From: John Leider Date: Sun, 21 Apr 2024 00:02:49 -0500 Subject: [PATCH] fix(VSnackbar): position based on app layout closes #15744 --- packages/vuetify/src/components/VSnackbar/VSnackbar.sass | 1 + packages/vuetify/src/components/VSnackbar/VSnackbar.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/vuetify/src/components/VSnackbar/VSnackbar.sass b/packages/vuetify/src/components/VSnackbar/VSnackbar.sass index e7ea46cdee2..d101831845e 100644 --- a/packages/vuetify/src/components/VSnackbar/VSnackbar.sass +++ b/packages/vuetify/src/components/VSnackbar/VSnackbar.sass @@ -7,6 +7,7 @@ z-index: $snackbar-z-index margin: $snackbar-wrapper-margin margin-inline-end: calc(#{$snackbar-wrapper-margin} + var(--v-scrollbar-offset)) + padding: var(--v-layout-top) var(--v-layout-right) var(--v-layout-bottom) var(--v-layout-left) &__wrapper align-items: center diff --git a/packages/vuetify/src/components/VSnackbar/VSnackbar.tsx b/packages/vuetify/src/components/VSnackbar/VSnackbar.tsx index 229531c91f8..df16e6fda2d 100644 --- a/packages/vuetify/src/components/VSnackbar/VSnackbar.tsx +++ b/packages/vuetify/src/components/VSnackbar/VSnackbar.tsx @@ -8,6 +8,7 @@ import { makeVOverlayProps } from '@/components/VOverlay/VOverlay' import { VProgressLinear } from '@/components/VProgressLinear' // Composables +import { useLayout } from '@/composables' import { forwardRefs } from '@/composables/forwardRefs' import { makeLocationProps } from '@/composables/location' import { makePositionProps, usePosition } from '@/composables/position' @@ -95,6 +96,7 @@ export const VSnackbar = genericComponent()({ setup (props, { slots }) { const isActive = useProxiedModel(props, 'modelValue') + const { mainStyles } = useLayout() const { positionClasses } = usePosition(props) const { scopeId } = useScopeId() const { themeClasses } = provideTheme(props) @@ -172,7 +174,10 @@ export const VSnackbar = genericComponent()({ positionClasses.value, props.class, ]} - style={ props.style } + style={[ + mainStyles.value, + props.style, + ]} { ...overlayProps } v-model={ isActive.value } contentProps={ mergeProps({