Debug with the accessibility tree
The web browser accessibility tree is an abstraction that browsers create based on the DOM (Document Object Model) to communicate with assistive technologies like screen readers.
This tree represents the semantic structure of the web content, focusing on accessibility information such as roles, names, states, and properties of elements. It simplifies the DOM and omits non-semantic information, ensuring that assistive technologies can efficiently interpret and interact with the content.
Where is it?
To access it, just go into your browser’s devtools:
- For chrome: in the elements section, click the accessibility icon
- For firefox, it has its own tab
How to use it?
Let’s inspect the back link of the the Alan login page.
Here you see an element with the role link named “Retour“, focusable. It contains a strong element with text “Retour”.
If you focus it, it will have an additional focused: true attribute.
The Ignored elements are a div, a span and a svg used to structure the HTML bloc but have no accessibility relevance.
You also can meet generic elements. Those are HTML elements without a defined role.
This is mostly the case with divs and span when they are not ignored.
⚠️ It is very important that non decorative elements have a well defined role ⚠️