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
feat(badge): a badge with some meaningful information should not have the aria-hidden=true attribute #26190
Comments
Hello @GregoireLgt, The badge has an -Zach |
Hi @zarend, I think this should do the trick. However it's still weird that the aria-hidden attribute is set at true and can't be changed as you can see below (from the first example at https://v14.material.angular.io/components/badge/overview) Corresponding badge code with aria-hidden true : That makes the content of the badge unreadable by assistive technologies since aria-hidden is true. As stated on MDN : So the solution is using an aria-describedby attribute to describe the content of the badge via the matBadgeDescription input if i am correct? In the example, the badge is communicating meaningful info (a number which could be anything depending on the context of your app), so i was wondering if just setting aria-hidden to false is more clean maybe in terms of accessibility? Regards |
@zarend i tried the matBadgeDescription input but i was not able to make my assistive technology read the matBadgeDescription. I also tried adding another element with the sr-only class in order to describe what's inside the badge but it was the same. That would be really helpful to change the aria-hidden attribute. Regards |
Hello @GregoireLgt , Thank you for following up with this. Which assistive technology are you using? -Zach |
@zarend i use NVDA : https://www.nvaccess.org/download/ Regards, |
Commenting here after finding this thread through Google. Our company's application was flagged for this same error while using a matBadge during an accessibility audit. Our implementation is to show the user how many errors exist on a form. Seeing how this would be deemed important information for the user to gather through a screenreader, we'd have to drop our usage of the badge until this (hopefully) gets addressed |
Hello folks, The matBadgeDescription is working better right now on interactive elements rather than static content. I believe the intention is that the matBadgeDescription is supposed to be read for both static and interactive elements, and developers shouldn't need to change the Here's a few work-arounds to try:
Hope that helps in the meantime before this gets addressed. -Zach |
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes angular#26190
…sts (#27025) The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes #26190
…sts (#27025) The badge current applies `aria-describedby` to surface the developer-provided description. However, assistive technology generally doesn't read these description on non-interactive elements. So, we can take advantage of our handy `InteractivityChecker` and do something different if the host is not focusable; we add the description inline as the next sibling with `.cdk-visually-hidden`. Fixes #26190 (cherry picked from commit f0a5008)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Feature Description
For accessibility purposes,
When you have a badge which communicates some meaningful information such as a number or something else, it should not have the aria-hidden=true attribute
So is it possible to create in the API a new "matBadgeAriaHidden" directive to set it manually according to the relevance of the badge content?
Use Case
No response
The text was updated successfully, but these errors were encountered: