Skip to content

fix(cdk/dialog): aria-hidden not restored when dialogs from parent and child are closed - #34043

Open
ewerton336 wants to merge 1 commit into
angular:mainfrom
ewerton336:fix/dialog-aria-hidden-nested
Open

ewerton336 wants to merge 1 commit into
angular:mainfrom
ewerton336:fix/dialog-aria-hidden-nested

Conversation

@ewerton336

Copy link
Copy Markdown

When a Dialog is provided at the component level, it shares its list of open dialogs with the
parent Dialog, but each instance tracked the elements it hid with aria-hidden separately.
Opening a dialog from a child Dialog and then one from the parent (or vice versa) meant that the
instance closing the last dialog had nothing to restore, so aria-hidden stayed on the page
content after all dialogs were closed, leaving the app inaccessible to assistive technology.

This change shares the map of hidden elements with the parent Dialog, following the same
pattern already used for openDialogs and afterAllClosed. A unit test covering the
parent/child scenario was added; it fails without the fix.

Fixes #30028

…d child are closed

The list of open dialogs is shared between a `Dialog` and its parent, but each instance was
keeping track of the elements it hid from assistive technology separately. If a dialog opened
by a child `Dialog` was closed while one opened by the parent was still open (or the other
way around), the instance that closed the last dialog didn't know about the hidden elements
and the `aria-hidden` attribute was never removed.

These changes share the map of hidden elements with the parent, the same way as the list
of open dialogs.

Fixes angular#30028

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(CDK Dialog): aria-hidden is not removed when a child dialog is opened before but closed after a parent dialog.

1 participant