Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/components/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
tabindex="-1"
{...(htmlAttributes as any)}
style={{
zIndex: `${40000 + this.overlayIndex}`,
zIndex: `${20000 + this.overlayIndex}`,
}}
onIonBackdropTap={this.onBackdropTap}
class={{
Expand Down
22 changes: 22 additions & 0 deletions core/src/components/loading/test/loading.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { newSpecPage } from '@stencil/core/testing';

import { config } from '../../../global/config';
import { Alert } from '../../alert/alert';
import { Loading } from '../loading';

describe('loading: custom html', () => {
Expand Down Expand Up @@ -62,3 +63,24 @@ describe('loading: custom html', () => {
expect(content.querySelector('button.custom-html')).toBe(null);
});
});

describe('loading: stacking', () => {
it('should stack an alert presented after a loading above it', async () => {
const page = await newSpecPage({
components: [Loading, Alert],
html: `<ion-loading is-open="true"></ion-loading>`,
});

const alert = document.createElement('ion-alert');
alert.isOpen = true;
page.body.appendChild(alert);
await page.waitForChanges();

const loading = page.body.querySelector('ion-loading')!;

const loadingZIndex = parseInt(loading.style.zIndex, 10);
const alertZIndex = parseInt(alert.style.zIndex, 10);

expect(alertZIndex).toBeGreaterThan(loadingZIndex);
});
});