Skip to content

Commit 1636989

Browse files
committed
refactor(overlays): add afterAddWrite
1 parent 9545d1a commit 1636989

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/src/utils/overlays.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ export const present = async <OverlayPresentOptions>(
539539

540540
const completed = await overlayAnimation(overlay, animationBuilder, overlay.el, opts);
541541
if (completed) {
542-
overlay.el.removeAttribute('aria-hidden');
543542
overlay.didPresent.emit();
544543
overlay.didPresentShorthand?.emit();
545544
}
@@ -753,6 +752,8 @@ const overlayAnimation = async (
753752
animation.duration(0);
754753
}
755754

755+
aniRoot.setAttribute('aria-hidden', 'true');
756+
756757
if (overlay.keyboardClose) {
757758
animation.beforeAddWrite(() => {
758759
const activeElement = baseEl.ownerDocument!.activeElement as HTMLElement;
@@ -762,15 +763,15 @@ const overlayAnimation = async (
762763
});
763764
}
764765

766+
animation.afterAddWrite(() => {
767+
aniRoot.removeAttribute('aria-hidden');
768+
});
769+
765770
const activeAni = activeAnimations.get(overlay) || [];
766771
activeAnimations.set(overlay, [...activeAni, animation]);
767772

768-
aniRoot.setAttribute('aria-hidden', 'true');
769-
770773
await animation.play();
771774

772-
aniRoot.removeAttribute('aria-hidden');
773-
774775
return true;
775776
};
776777

0 commit comments

Comments
 (0)