Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: root remains aria-hidden after dismissing multiple overlays consecutively #29396

Open
3 tasks done
nagashimam opened this issue Apr 25, 2024 · 0 comments
Open
3 tasks done
Labels
needs: investigation This issue is waiting on more investigation from the Ionic Team.

Comments

@nagashimam
Copy link

nagashimam commented Apr 25, 2024

Prerequisites

Ionic Framework Version

v7.x, v8.x

Current Behavior

Consider this scenario:
A modal that contains a form is presented. You try to close it, and a confirmation dialog is presented. You click "confirm", and the confirmation dialog is dismissed first. And in the confirmation dialog's willDismiss life cycle, the form modal is dismissed too. And then, the root element such as ion-router-outlet remains aria-hidden.

Note the root is not aria-hidden when the form modal is dismissed on the confirmation dialog's didDismiss life cycle.¥

Expected Behavior

Regardless of whether the didDismiss or willDismiss lifecycle events are used to trigger the dismissal of another overlay, the root element should not remain aria-hidden. Alternatively, the documentation should explicitly note this behavior and recommend using didDismiss for dismissing another overlay instead of willDismiss.

Steps to Reproduce

  1. Open the reproduction page.
  2. Click "Open", and an ion-modal will be presented.
  3. Click "Close", and an ion-action-sheet will be presented.
  4. Click "Yes", and both the ion-modal and ion-action-sheet will be dismissed.
  5. Open the dev tool, and note the ion-router-outlet is marked as aria-hidden.
  6. Go to the code reproduction page.
  7. Change actionSheet.onDidDismiss(); on line 35 to actionSheet.onWillDismiss();, and save.
  8. Refresh the reproduction page and repeat the same procedure.
  9. Observe that the ion-router-outlet is NOT marked as aria-hidden.

Code Reproduction URL

https://stackblitz.com/edit/angular-ffa5nq?file=src%2Fapp%2Fexample.component.ts

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (/Users/mzb0005/.anyenv/envs/nodenv/versions/20.11.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.8.0
@angular-devkit/build-angular : 17.3.0
@angular-devkit/schematics : 17.3.0
@angular/cli : 17.3.0
@ionic/angular-toolkit : 11.0.1

Cordova:

Cordova CLI : 12.0.0 ([email protected])
Cordova Platforms : android 12.0.1, ios 7.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, (and 43 other plugins)

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

ios-deploy : 1.12.2
ios-sim : ios-sim/9.0.0 darwin-arm64 node-v20.11.1
NodeJS : v20.11.1 (/Users/mzb0005/.anyenv/envs/nodenv/versions/20.11.1/bin/node)
npm : 10.2.4
OS : macOS Unknown
Xcode : Xcode 15.2 Build version 15C500b

Additional Information

Additional Information

Cause of the Behavior

During the first overlay's dismiss, the willDismiss event is emitted, and the second modal's dismiss is queued in the microtask queue. And after that, awaiting overlayAnimation puts everything after that lines to the microtask queue.

This sequence causes the second overlay's dismiss to execute before the first overlay has added "overlay-hidden" to its classList. From the perspective of the second overlay, two modals are still present and not hidden, so it skips calling setRootAriaHidden(false).

Possible Fix

One possible solution could involve implementing a flag that indicates an overlay is being dismissed, which might manage the timing issue more effectively. Here's a commit with a possible fix.

@ionitron-bot ionitron-bot bot added the triage label Apr 25, 2024
@nagashimam nagashimam changed the title bug: Root Remains aria-hidden After Dismissing Multiple Overlays Consecutively bug: root remains aria-hidden after dismissing multiple overlays consecutively Apr 25, 2024
@thetaPC thetaPC added the needs: investigation This issue is waiting on more investigation from the Ionic Team. label Apr 30, 2024
@ionitron-bot ionitron-bot bot removed the triage label Apr 30, 2024
@thetaPC thetaPC removed their assignment Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: investigation This issue is waiting on more investigation from the Ionic Team.
Projects
None yet
Development

No branches or pull requests

2 participants