How web browsers work - creating the accessibility tree (part 6, with illustrations)🌴🐱‍💻
Tags: html, css, javascript, webdev
Published: 2022-05-08 09:35:52

Besides all these trees we've been talking about until now (DOM, CSSOM and AST), browsers also build something called the `accessibility tree`.

>`Accessibility (often abbreviated to A11y — as in, "a", then 11 characters, and then "y") in web development means enabling as many people as possible to use websites, even when those people's abilities are limited in some way. For many people, technology makes things easier. For people with disabilities, technology makes things possible. Accessibility means developing content to be as accessible as possible, no matter an individual's physical and cognitive abilities and how they access the web (ACT).`

## 6. BUILDING THE ACCESSIBILITY TREE

In general, disabled users can and do use web pages with a variety of assistive technologies. They use screenreaders, magnifiers, eye tracking, voice commands and more. In order for any of these technologies to work, they need to be able to access the page's content. And since they can't read the DOM directly, the ACT comes into play. 

The accessibility tree is built using the DOM and it will be later used by the assistive devices to parse and interpret the content of the webpage we are visiting. ACT is like a semantic version of the DOM and it gets updated every time the DOM gets updated. Each DOM element that needs to be exposed to assistive technologies will have a corespondent node in the ACT. Until the ACT is not built, the content is not accessible to screen readers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gugy39zsayyjq844i5t2.jpg)

To view what the accessibility tree actually looks like, you can use Google Chrome by going to a page of your choosing. Open the debugger (F12) and go to the `Elements` tab. From there, on the right side you can select the `Accessibility` pane.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9mikz499vy8r2jyqwi1.JPG)

I went to Google and inspected the search input and this is what I got in the `Accessibility pane` under `Computed`:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xzeho6dy87c6uewteudn.png)

The importance of using semantic HTML is beyond the scope of this article, but as developers, we should all keep in mind that the websites we build should be made availabe to everyone who wishes to use them. If you want to read more on the subject, a good introductory article into web accessibility can be found [here](https://www.w3.org/WAI/fundamentals/accessibility-intro/#:~:text=Web%20accessibility%20means%20that%20websites,and%20interact%20with%20the%20Web). According to [The Internet Society Accessibility Special Interest Group](https://www.a11ysig.org/), there are now over 1.3 billion people worldwide – about 15 percent of the world's population – that experience some form of disability.

**Resource refrences:**
- [w3.org - Introduction to Web Accessibility](https://www.w3.org/WAI/fundamentals/accessibility-intro/)
- [MDN Web Docs - Accessibility](https://developer.mozilla.org/en-US/docs/Web/Accessibility)
- [WAI-ARIA Roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles)