Skip to content

Commit be2024b

Browse files
committed
(a11y): blur active element before setting aria-hidden
1 parent 7b8097b commit be2024b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/utils/overlays.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,9 @@ export const present = async <OverlayPresentOptions>(
512512
if (overlay.presented) {
513513
return;
514514
}
515-
515+
516516
console.log("presenting overlay...");
517+
(document.activeElement as HTMLElement)?.blur();
517518

518519
/**
519520
* Due to accessibility guidelines, toasts do not have
@@ -524,6 +525,7 @@ export const present = async <OverlayPresentOptions>(
524525
*/
525526
if (overlay.el.tagName !== 'ION-TOAST') {
526527
setRootAriaHidden(true);
528+
document.body.classList.add(BACKDROP_NO_SCROLL);
527529
}
528530

529531
hideUnderlyingOverlaysFromScreenReaders(overlay.el);
@@ -649,6 +651,8 @@ export const dismiss = async <OverlayDismissOptions>(
649651
return false;
650652
}
651653

654+
(document.activeElement as HTMLElement)?.blur();
655+
652656
const presentedOverlays = doc !== undefined ? getPresentedOverlays(doc) : [];
653657

654658
/**

0 commit comments

Comments
 (0)