See Also: ARIA States 101
ARIA roles work now in many browsers and screen readers. When they don’t, they are harmless.
ARIA specifies the following:
- Roles to describe the type of widget presented, such as “menu,” “treeitem,” “slider,” and “progressmeter”
- Roles to describe the structure of the Web page, such as headings, regions, and tables (grids)
- Properties to describe the state widgets are in, such as “checked” for a check box, or “haspopup” for a menu.
- Properties to define live regions of a page that are likely to get updates (such as stock quotes), as well as an interruption policy for those updates—for example, critical updates may be presented in an alert dialog box, and incidental updates occur within the page
- Properties for drag-and-drop that describe drag sources and drop targets
- A way to provide keyboard navigation for the Web objects and events, such as those mentioned above
This article will look at the first two items dealing with ARIA roles.
How to use roles
As the list mentioned, roles describe widgets and structure. Structural roles are added to markup as attributes of elements. In XHTML, for example:
<div id="header" role="banner">
<div id="nav" role="navigation">
or in HTML5
Roles used in ways like the preceding examples are navigation aids for machine readers and for assistive devices such as screen readers.
Roles that describe widgets are added to markup with additional information. The role in the example below identifies the element as a slider, with additional values using the aria prefix prepended to the property name. For example, in a slider widget that allows the user to select the day of the week, the values 1 – 7 indicate the days of the week. The first day of the week, number 1, is Sunday. The
aria-valuemax restrict the options in the slider to 1 – 7.
List of roles
The W3C list of roles is quoted below. Links go to further definitions of each role on the W3C site.
Roles that act as standalone user interface widgets or as part of larger, composite widgets.
Roles that act as composite user interface widgets. These roles typically act as containers that manage other, contained widgets.
Roles that describe document structures that organize content in a page.