Skip to content

Commit 2b9a58f

Browse files
committed
fix(overlays): add class when overlay is not toast
1 parent 94a5ec7 commit 2b9a58f

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

core/src/utils/overlays.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,9 @@ export const present = async <OverlayPresentOptions>(
520520
*/
521521
if (overlay.el.tagName !== 'ION-TOAST') {
522522
setRootAriaHidden(true);
523+
document.body.classList.add(BACKDROP_NO_SCROLL);
523524
}
524525

525-
document.body.classList.add(BACKDROP_NO_SCROLL);
526-
527526
hideUnderlyingOverlaysFromScreenReaders(overlay.el);
528527
hideAnimatingOverlayFromScreenReaders(overlay.el);
529528

@@ -648,8 +647,6 @@ export const dismiss = async <OverlayDismissOptions>(
648647

649648
const presentedOverlays = doc !== undefined ? getPresentedOverlays(doc) : [];
650649

651-
const isLastOverlay = presentedOverlays.length === 1;
652-
653650
/**
654651
* For accessibility, toasts lack focus traps and don’t receive
655652
* `aria-hidden` on the root element when presented.
@@ -671,9 +668,6 @@ export const dismiss = async <OverlayDismissOptions>(
671668
*/
672669
if (lastOverlayNotToast) {
673670
setRootAriaHidden(false);
674-
}
675-
676-
if (isLastOverlay) {
677671
document.body.classList.remove(BACKDROP_NO_SCROLL);
678672
}
679673

0 commit comments

Comments
 (0)