Skip to content

fix(material/dialog): update aria-labelledby if title is swapped #27609

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

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 9, 2023

Currently the dialog assigns the ID of the title as the aria-labelleledby of the container, but it doesn't update it if the title is swapped out or removed.

These changes add a queue of possible IDs that the container can use as titles as they are being created or destroyed.

Fixes #27599.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release labels Aug 9, 2023
@@ -145,7 +145,7 @@ function parseCssTime(time: string | number | undefined): number | null {
'[attr.aria-modal]': '_config.ariaModal',
'[id]': '_config.id',
'[attr.role]': '_config.role',
'[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
'[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]',
Copy link
Member Author

@crisbeto crisbeto Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that aria-labelledby supports passing a list of IDs so we could've also used all the IDs here, but I think that for the dialog case it makes sense to only have one label at a time.

@crisbeto crisbeto force-pushed the 27599/dialog-swap-title branch from 6c3dda0 to 0f99294 Compare August 9, 2023 09:00
Copy link
Contributor

@andrewseguin andrewseguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird to have to use a queue but I see why

@devversion devversion removed their request for review August 9, 2023 11:36
@crisbeto crisbeto self-assigned this Aug 9, 2023
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Aug 9, 2023
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto force-pushed the 27599/dialog-swap-title branch from 0f99294 to dd50f2e Compare August 9, 2023 17:39

Unverified

This user has not yet uploaded their public signing key.
Currently the dialog assigns the ID of the title as the `aria-labelleledby` of the container, but it doesn't update it if the title is swapped out or removed.

These changes add a queue of possible IDs that the container can use as titles are being created or destroyed.

Fixes angular#27599.
@crisbeto crisbeto force-pushed the 27599/dialog-swap-title branch from dd50f2e to 40a011a Compare August 10, 2023 12:30
@crisbeto crisbeto merged commit 642d886 into angular:main Aug 10, 2023
crisbeto added a commit that referenced this pull request Aug 10, 2023

Unverified

This user has not yet uploaded their public signing key.
)

Currently the dialog assigns the ID of the title as the `aria-labelleledby` of the container, but it doesn't update it if the title is swapped out or removed.

These changes add a queue of possible IDs that the container can use as titles are being created or destroyed.

Fixes #27599.

(cherry picked from commit 642d886)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) action: merge The PR is ready for merge by the caretaker G This is is related to a Google internal issue P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(MatDialog): mat-dialog-title does not reset the `aria-labelledby
3 participants