The Web Accessibility Initiative's Accessible Rich Internet Applications specification (WAI-ARIA, or just ARIA) is good for bridging areas with accessibility issues that can't be managed with native HTML. It works by allowing you to specify attributes that modify the way an element is translated into the accessibility tree. Let's look at an example.
In the following snippet, we use a list item as a kind of custom checkbox. The CSS "checkbox" class gives the element the required visual characteristics.
Receive promotional offers
While this works fine for sighted users, a screen reader will give no indication that the element is meant to be a checkbox, so low-vision users may miss the element entirely.
Using ARIA attributes, however, we can give the element the missing information so the screen reader can
properly interpret it. Here, we've added the role
and aria-checked
attributes to explicitly identify the element as a checkbox and to specify
that it is checked by default. The list item will now be added to the accessibility tree and a screen reader
will correctly report it as a checkbox.
Receive promotional offers
ARIA works by changing and augmenting the standard DOM accessibility tree.
Although ARIA allows us to subtly (or even radically) modify the accessibility tree for any element on the page, that is the only thing it changes. ARIA doesn't augment any of the element's inherent behavior; it won't make the element focusable or give it keyboard event listeners. That is still part of our development task.
It's important to understand that there is no need to redefine default semantics. Regardless of its use, a
standard HTML element doesn't need an additional
role="checkbox"
ARIA attribute to be correctly announced.
It's also worth noting that certain HTML elements have restrictions on what ARIA roles and attributes can be
used on them. For example, a standard element may not have
any additional role/attribute applied to it.