Accessibility API – a brief introduction

Note: This post is older than two years. It may still be totally valid, but things change and technology moves fast. Code based posts may be especially prone to changes...

(Read 690 times)

This API is just an interface that assistive technologies and user agents use to communicate. It is important to know that there are differences between vendor solutions so testing is a bit more complex but crucial.

User agents (browsers but also any other software that retrieves, renders, and facilitates end user interaction with (web) content) must translate web content and it’s semantic elements to assistive technologies. This is a job for accessibility API.

As with any other Application Programming Interface (API), it’s mission is to provide a communication channel – this one is used to expose names, roles, states, events and other properties to assistive technologies. In practice we can simplify it as a communication channel between browser and screen-reader, based on the DOM tree and some other rules too (some CSS is also needed, for example visibility and display properties that can be inline or not).

We will not go into details of past practices, but let’s just mention that assistive technologies originally used some strange techniques to define the meaning of UI and it’s elements. For example – seeing a list with links at the top of the page was interpreted as a navigation menu.

This has obvious not been the most correct assumption for every scenario, therefore a common, more standard way had to be defined. And here comes the role of Accessibility API – as a much better way for the software communication. The downside is that platform (OS or browser) owners developed specialized interfaces for their APIs independently. Therefore the APIs can have different interpretations for same definitions, found in the DOM.

But nonetheless their main task is to include the accessibility tree and expose it to assistive technologies. To do so efficiently they have to provide the following:

  • All properties that are descriptive (name, value, role, description, …),
  • Important states (button pressed, checkbox checked, element focusable, …),
  • Event states (button was clicked, checkbox was checked, …),
  • Hierarchy and relationships (element controls another, grandparent / parent / child, ….).

So Accessibility API is actually generating the Accessibility tree but not just in it’s static form – it also makes care that user interaction is reflected in the needed properties. Therefore we can see it as a two-way channel that enables assistive technologies to get the latest state of the user agent view with all the interactions and changes.

As mentioned before – there are different Accessibility APIs for different vendors and they can work differently. So in many cases there is no simple way to check their support or how do they expose accessibility tree to user agents.

This is crucial for our developer and testing efforts, and explains also why some assistive technologies work (better) with specific Operating Systems and User Agents. The solution is therefore to investigate and test with different technologies.

More information on Accessibility API from the core team (opens in new window).

Author: Bogdan Cerovac

I am IAAP certified Web Accessibility Specialist (from 2020) and was Google certified Mobile Web Specialist.

Work as digital agency co-owner web developer and accessibility lead.

Sole entrepreneur behind IDEA-lab Cerovac (Inclusion, Diversity, Equity and Accessibility lab) after work. Check out my Accessibility Services if you want me to help your with digital accessibility.

Also head of the expert council at Institute for Digital Accessibility A11Y.si (in Slovenian).

Living and working in Norway (🇳🇴), originally from Slovenia (🇸🇮), loves exploring the globe (🌐).

Nurturing the web from 1999, this blog from 2019.

More about me and how to contact me: