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

aria-labelledby on a div without a role is not useful #3119

Closed
jcoyne opened this issue Jan 17, 2024 · 3 comments · Fixed by #3129
Closed

aria-labelledby on a div without a role is not useful #3119

jcoyne opened this issue Jan 17, 2024 · 3 comments · Fixed by #3129

Comments

@jcoyne
Copy link
Member

jcoyne commented Jan 17, 2024

I think we should revert b787f37

Using aria-labelledby in this way is no longer recommended by Bootstrap https://getbootstrap.com/docs/5.3/components/accordion/ (removed in twbs/bootstrap#37766)

Siteimprove is flagging this for us:
Screenshot 2024-01-17 at 2 31 32 PM

aria-label does not work on <div> nor <span>.

A <div> and <span> are neither landmarks nor interactive content. An aria-label will not be read by a screen reader (and rightly so).

https://stackoverflow.com/a/42682268/162852

Another possibility is adding role="group"

@dbranchini
Copy link

I need to dig a bit more on this, because I use this site a lot for aria guidance - https://www.w3.org/WAI/WCAG21/Techniques/#aria, and I found this (with an alert that their example still needs additional testing) - https://www.w3.org/WAI/ARIA/apg/patterns/accordion/examples/accordion/ where they are using aria-labelledby in the exact same way as we are. Yet, I see how SiteImprove is picking this up as an error too.

@jcoyne
Copy link
Member Author

jcoyne commented Jan 19, 2024

@dbranchini it looks like the accordion example there uses role="region", which seems like a reasonable solution if you agree.

@dbranchini
Copy link

Yes, that sounds like a good solution.

@jcoyne jcoyne changed the title aria-labelledby on a div is not useful aria-labelledby on a div without a role is not useful Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants