Repository navigation
fix(loading): use the same z-index base as the other overlays - #31796
Open
ngocanhnckh wants to merge 1 commit into
Open
ngocanhnckh wants to merge 1 commit into
ngocanhnckh wants to merge 1 commit into
Conversation
The loading overlay used a z-index base of 40000 while alert, action sheet, modal and popover use 20000, so a loading indicator always covered an overlay presented after it. With the same base, the z-index follows the order the overlays were presented in. Closes ionic-team#30029
|
@ngocanhnckh is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Issue number: resolves #30029
What is the current behavior?
ion-loadingsets itsz-indexfrom a base of 40000 plus the overlay counter.ion-alert,ion-action-sheet,ion-modalandion-popoveruse 20000. A loading indicator therefore always paints over those overlays, even when they are presented after it. An alert opened while a loading indicator is showing is hidden behind it and its buttons cannot be clicked.Measured in the core test app (loading presented, then alert): loading
z-index: 40002, alertz-index: 20004.What is the new behavior?
ion-loadinguses a base of 20000, the same as the other overlays, so stacking follows the order overlays were presented in. This is the direction agreed in the issue.ion-toastkeeps its higher base.z-indexis higher. It fails without the fix and passes with it.z-index: 20002, alertz-index: 20004.Does this introduce a breaking change?
An overlay presented after a loading indicator now stacks above it, and a loading presented while a modal/alert/popover is open now stacks above that, matching present order.
Other information
Tested with a local test page (loading then alert) at 375px and 1280px, light and dark. Commands:
npx stencil test --spec -- src/utils src/components/{loading,alert,action-sheet,modal,popover,toast}(426 passed), eslint and prettier on the touched files. Playwright e2e was not run locally (browser version mismatch, screenshot tests need Docker).The red boxes in the before shots mark the broken part.
I also checked this with renderlint, an open-source CLI I maintain that renders pages in a headless browser and reports layout defects. Before the change it flags the alert at 375px as sitting under the loading overlay (
focus-obscured); after it, it reports nothing. If it would be useful, I'm happy to open a follow-up PR that runs it on the test pages in CI; no pressure either way.