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(MatSlideToggle): Unlabelled slide toggle cannot be labeled by a dynamically set aria-label #23094

Closed
wildcardalice opened this issue Jun 30, 2021 · 4 comments · Fixed by #23104
Assignees
Labels
area: material/slide-toggle feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@wildcardalice
Copy link

Reproduction

https://angular-j8a87w.stackblitz.io

Steps to reproduce:

  1. Open Chrome inspector and inspect the mat-slide-toggle, note that it doesn't have an aria-label
  2. Expand the DOM tree and note that the nested input also doesn't have an aria-label
  3. Inspect the checkbox on the page, which is similarly labeled, and note that the aria-label applies properly

image

Expected Behavior

[attr.aria-label]="..." should apply an aria-label to the slide toggle and the nested input element

Actual Behavior

Applying a dynamic aria-label to an unlabeled mat-slide-toggle does not currently seem possible

Environment

@wildcardalice wildcardalice added the needs triage This issue needs to be triaged by the team label Jun 30, 2021
@crisbeto
Copy link
Member

The attr.aria-label won't work because we don't have a good way of picking it up. We do have an aria-label input so doing something like [aria-label]="..." should work.

@wildcardalice
Copy link
Author

Ah I see. Are there any plans to support aria-describedby in a similar way to aria-label?

@crisbeto crisbeto self-assigned this Jul 2, 2021
@crisbeto crisbeto added area: material/slide-toggle feature This issue represents a new feature or feature request rather than a bug or bug fix has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Jul 2, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 2, 2021
Similarly to other input-based components, these changes add an `aria-describedby` input to the slide toggle.

Fixes angular#23094.
@crisbeto
Copy link
Member

crisbeto commented Jul 2, 2021

I've submitted #23104 to add support for it.

wagnermaciel pushed a commit that referenced this issue Jul 9, 2021
Similarly to other input-based components, these changes add an `aria-describedby` input to the slide toggle.

Fixes #23094.
@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 Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/slide-toggle feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants