-
Notifications
You must be signed in to change notification settings - Fork 471
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
header/footer elements incorrectly inferred with banner/contentinfo role when nested in section #1334
Comments
Hi @matt-pawley! |
Some spec links: https://www.w3.org/TR/html-aria/#el-footer
https://www.w3.org/TR/html-aria/#el-header
— It is worth noting that The difficulty is that the interface isn’t particularly consumer friendly and dom-testing-library does not consider these specific constraints as-is. It could be updated to do so, but feels like a fragile interface to couple to… an issue could be raised to see if something else could replace it in a breaking change?
I have recently been shown https://github.com/drwpow/html-aria which can cater to these requirements (I have passing web platform tests in a separate repo using this) which @drwpow has put together. Appreciate worthy of a separate issue, but worth exploring whether it stands as a more spec accurate drop-in replacement for — Though also worth asking the question whether dom-testing-library can/should support DOM context based roles. Depending on how it is consumed the library may not even be able to provide the correct role even with this logic - e.g. if composing components in separate units then very possible that a |
@testing-library/dom
version: 10.4.0Relevant code or config:
What you did:
Expected that only header/footer elements that are decedents of section elements don't have roles of
banner
/contentinfo
as per the MDN docs:What happened:
Elements have the aforementioned roles.
Reproduction:
https://codesandbox.io/p/sandbox/react-testing-library-bug-reproduction-sw7zzf?file=%2Fsrc%2FApp.js%3A4%2C1-12%2C6
Problem description:
Conflicts with the MDN docs/browser accessibility tree.
The text was updated successfully, but these errors were encountered: