fix(stack): recompute z-index for overlays outside global stack#22790
Closed
Luminet2023 wants to merge 2 commits intovuetifyjs:masterfrom
Closed
fix(stack): recompute z-index for overlays outside global stack#22790Luminet2023 wants to merge 2 commits intovuetifyjs:masterfrom
Luminet2023 wants to merge 2 commits intovuetifyjs:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When using
v-snackbar-queue, a snackbar triggered from inside av-dialogcan keep a stale z-index after the dialog is closed.VSnackbaruses_disableGlobalStack, so it does not create its own entry inglobalStack. However, its z-index is still computed when it becomes active. If a snackbar is opened while a dialog is active, it can capture a z-index derived from the dialog stack state.After the dialog is closed, that snackbar keeps the stale z-index. When new snackbars are added later, queued items may conflict with each other visually, causing incorrect overlap or stacking order.
Reproduction steps:
Problem
Overlays that opt out of
globalStackcan keep a stale z-index.useStack()computes_zIndexwhen the overlay becomes active, andstackStylesalways returns that cached value. This works for overlays that participate inglobalStack, but overlays created with_disableGlobalStackdo not create their own stack entry.As a result, if the global stack changes after one of these overlays is shown, its z-index may no longer reflect the current top of the stack.
Fix
Extract the shared z-index calculation into
getStackZIndex()and reuse it both when the overlay becomes active and when resolvingstackStyles.For overlays that participate in
globalStack, behavior stays the same.For overlays outside
globalStack,stackStylesnow derives z-index from the latest global stack state instead of always returning the cached_zIndexvalue.Markup: