Skip to content

Commit 94a5ec7

Browse files
committed
refactor(overlays): update code order and add GH issue
1 parent ab25c71 commit 94a5ec7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

core/src/utils/overlays.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,6 @@ export const dismiss = async <OverlayDismissOptions>(
650650

651651
const isLastOverlay = presentedOverlays.length === 1;
652652

653-
if (isLastOverlay) {
654-
document.body.classList.remove(BACKDROP_NO_SCROLL);
655-
}
656-
657653
/**
658654
* For accessibility, toasts lack focus traps and don’t receive
659655
* `aria-hidden` on the root element when presented.
@@ -677,6 +673,10 @@ export const dismiss = async <OverlayDismissOptions>(
677673
setRootAriaHidden(false);
678674
}
679675

676+
if (isLastOverlay) {
677+
document.body.classList.remove(BACKDROP_NO_SCROLL);
678+
}
679+
680680
overlay.presented = false;
681681

682682
try {

core/src/utils/test/overlays/overlays-scroll-blocking.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ describe('overlays: scroll blocking', () => {
8787
expect(body).not.toHaveClass('backdrop-no-scroll');
8888
});
8989

90+
// Fixes https://github.com/ionic-team/ionic-framework/issues/30112
9091
it('should not enable scroll until last toast overlay is dismissed', async () => {
9192
const page = await newSpecPage({
9293
components: [Toast],

0 commit comments

Comments
 (0)