Testing for Accessibility
One of the guiding principles of the Testing Library APIs is that they should enable you to test your app the way your users use it, including through accessibility interfaces like screen readers.
See the page on queries for details on how using a semantic HTML query can make sure your app works with browser accessibility APIs.
This function allows iteration over the implicit ARIA roles represented in a given tree of DOM nodes.
It returns an object, indexed by role name, with each value being an array of elements which have that implicit ARIA role.
See ARIA in HTML for more information about implicit ARIA roles.
This function will compute if the given element should be excluded from the
accessibility API by the browser. It implements every MUST criteria from the
Excluding Elements from the Accessibility Tree
section in WAI-ARIA 1.2 with the exception of checking the
It is defined as:
This helper function can be used to print out a list of all the implicit ARIA roles within a tree of DOM nodes, each role containing a list of all of the nodes which match that role. This can be helpful for finding ways to query the DOM under test with getByRole