Skip to content

Commit 6b8bd24

Browse files
committed
refactor(overlays): move set and remove
1 parent a639c85 commit 6b8bd24

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

core/src/utils/overlays.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const createOverlay = <T extends HTMLIonOverlayElement>(
114114
return window.customElements.whenDefined(tagName).then(() => {
115115
const element = document.createElement(tagName) as HTMLIonOverlayElement;
116116
element.classList.add('overlay-hidden');
117+
element.setAttribute('aria-hidden', 'true');
117118

118119
/**
119120
* Convert the passed in overlay options into props
@@ -744,6 +745,7 @@ const overlayAnimation = async (
744745
): Promise<boolean> => {
745746
// Make overlay visible in case it's hidden
746747
baseEl.classList.remove('overlay-hidden');
748+
baseEl.removeAttribute('aria-hidden');
747749

748750
const aniRoot = overlay.el;
749751
const animation = animationBuilder(aniRoot, opts);
@@ -753,9 +755,6 @@ const overlayAnimation = async (
753755
}
754756

755757
animation.beforeAddWrite(() => {
756-
console.log('beforeAddWrite');
757-
baseEl.setAttribute('aria-hidden', 'true');
758-
759758
if (overlay.keyboardClose) {
760759
const activeElement = baseEl.ownerDocument!.activeElement as HTMLElement;
761760
if (activeElement?.matches('input,ion-input, ion-textarea')) {
@@ -764,11 +763,6 @@ const overlayAnimation = async (
764763
}
765764
});
766765

767-
animation.afterAddWrite(() => {
768-
baseEl.removeAttribute('aria-hidden');
769-
console.log('afterAddWrite');
770-
});
771-
772766
const activeAni = activeAnimations.get(overlay) || [];
773767
activeAnimations.set(overlay, [...activeAni, animation]);
774768

0 commit comments

Comments
 (0)