@@ -524,6 +524,7 @@ export const present = async <OverlayPresentOptions>(
524524 document . body . classList . add ( BACKDROP_NO_SCROLL ) ;
525525
526526 hideUnderlyingOverlaysFromScreenReaders ( overlay . el ) ;
527+ hideAnimatingOverlayFromScreenReaders ( overlay . el ) ;
527528
528529 overlay . presented = true ;
529530 overlay . willPresent . emit ( ) ;
@@ -535,8 +536,6 @@ export const present = async <OverlayPresentOptions>(
535536 ? overlay . enterAnimation
536537 : config . get ( name , mode === 'ios' ? iosEnterAnimation : mdEnterAnimation ) ;
537538
538- // hideAnimatingOverlayFromScreenReaders(overlay.el);
539-
540539 const completed = await overlayAnimation ( overlay , animationBuilder , overlay . el , opts ) ;
541540 if ( completed ) {
542541 overlay . didPresent . emit ( ) ;
@@ -752,28 +751,14 @@ const overlayAnimation = async (
752751 animation . duration ( 0 ) ;
753752 }
754753
755- animation . beforeAddWrite ( ( ) => {
756- console . log ( 'beforeAddWrite' ) ;
757- const overlayWrapper = baseEl . querySelector ( '.ion-overlay-wrapper' ) ;
758- if ( overlayWrapper ) {
759- overlayWrapper . setAttribute ( 'aria-hidden' , 'true' ) ;
760- }
761-
762- if ( overlay . keyboardClose ) {
754+ if ( overlay . keyboardClose ) {
755+ animation . beforeAddWrite ( ( ) => {
763756 const activeElement = baseEl . ownerDocument ! . activeElement as HTMLElement ;
764757 if ( activeElement ?. matches ( 'input,ion-input, ion-textarea' ) ) {
765758 activeElement . blur ( ) ;
766759 }
767- }
768- } ) ;
769-
770- animation . afterAddWrite ( ( ) => {
771- const overlayWrapper = baseEl . querySelector ( '.ion-overlay-wrapper' ) ;
772- if ( overlayWrapper ) {
773- overlayWrapper . removeAttribute ( 'aria-hidden' ) ;
774- }
775- console . log ( 'afterAddWrite' ) ;
776- } ) ;
760+ } ) ;
761+ }
777762
778763 const activeAni = activeAnimations . get ( overlay ) || [ ] ;
779764 activeAnimations . set ( overlay , [ ...activeAni , animation ] ) ;
@@ -995,11 +980,15 @@ export const createTriggerController = () => {
995980const hideAnimatingOverlayFromScreenReaders = ( overlay : HTMLIonOverlayElement ) => {
996981 if ( doc === undefined ) return ;
997982
998- /**
999- * Once the animation is complete, this attribute will be removed.
1000- * This is done at the end of the `present` method.
1001- */
1002- overlay . setAttribute ( 'aria-hidden' , 'true' ) ;
983+ const mode = getIonMode ( overlay ) ;
984+
985+ if ( mode === 'md' ) {
986+ /**
987+ * Once the animation is complete, this attribute will be removed.
988+ * This is done at the end of the `present` method.
989+ */
990+ overlay . setAttribute ( 'aria-hidden' , 'true' ) ;
991+ }
1003992} ;
1004993
1005994/**
0 commit comments