ARIA role

On this page 7

An ARIA role is a value of the role attribute, defined by the WAI-ARIA specification, that tells assistive technologies what kind of element a piece of markup represents, for example a button, a dialog, a tab or a navigation landmark. In web accessibility, roles fill the gap when native HTML semantics are missing or insufficient, so that screen readers and voice control software can announce and operate custom interface components correctly.

A role changes only the semantics exposed in the accessibility tree. It does not add keyboard behavior, focusability or visual styling, which is why the first rule of ARIA advises using a native HTML element whenever one exists before reaching for a role.

How an ARIA role reaches assistive technology

Browsers build an accessibility tree in parallel with the DOM, and an ARIA role overrides the implicit role that the browser would otherwise compute for an element. A div normally has the generic role, but role="button" makes the browser report it to the platform accessibility API as a button.

Operating systems expose that information through platform accessibility APIs such as UI Automation and MSAA on Windows, NSAccessibility on macOS and AT-SPI on Linux. Screen readers like NVDA, JAWS and VoiceOver read the role from these APIs and announce it together with the accessible name and state, for example “Save, button” or “Settings, expanded, button”.

The table below separates what a role does from what it leaves to the developer, which is the most frequently misunderstood point about ARIA.

AspectChanged by the roleDeveloper responsibility
Announced element typeYesChoose the correct role
Keyboard focusNoAdd tabindex="0" when needed
Keyboard interactionNoHandle Enter, Space and arrow keys
States and propertiesNoMaintain aria-expanded, aria-selected and similar
Visual appearanceNoStyle with CSS, including focus indicators
Accessible namePartly, for some rolesProvide visible text or aria-label
What an ARIA role changes and what it does not

Categories of ARIA roles

WAI-ARIA groups roles into categories by purpose, and each category implies different authoring obligations. Abstract roles such as widget or landmark exist only to structure the taxonomy and must never be used in markup.

CategoryPurposeExample roles
Widget rolesInteractive controlsbutton, checkbox, slider, tab
Composite widget rolesContainers that manage child focusmenu, tablist, grid, listbox
Document structure rolesDescribe content organizationheading, list, article, img
Landmark rolesMark major page regionsbanner, navigation, main, contentinfo
Live region rolesAnnounce dynamic updatesalert, status, log, timer
Window rolesMark separate windowsdialog, alertdialog
Main ARIA role categories

Some roles carry required owned elements or required context. A tablist must contain elements with role tab, and a menuitem must sit inside a menu or menubar. Breaking these parent and child relationships produces an invalid accessibility tree that screen readers may announce inconsistently.

Implicit roles of native HTML elements

Most HTML elements already map to an ARIA role, a mapping defined in the HTML Accessibility API Mappings specification. Adding the same role explicitly is redundant, and replacing a native element with a styled div plus a role usually costs more code and introduces bugs.

Native elementImplicit roleBuilt-in behavior lost with a div
`button`buttonFocus, Enter and Space activation
`a` with `href`linkFocus, Enter activation, context menu
`nav`navigationLandmark navigation shortcut
`main`mainSkip-to-content landmark
`input type=”checkbox”`checkboxChecked state, Space toggling, form submission
`dialog`dialogModal focus containment with showModal()
Native elements and their implicit ARIA roles

This mapping explains why an ARIA role is best treated as a repair or extension tool. It is the right choice for patterns that HTML lacks natively, such as tabs, tree views, comboboxes and data grids, and for retrofitting legacy markup that cannot be rewritten quickly.

Choosing and applying the correct role

Choosing a role starts with what the component does, not with how it looks. A control that triggers an action is a button; one that navigates to a new URL is a link, even if both are styled identically. The ARIA Authoring Practices Guide documents the expected keyboard model for each widget pattern.

The following decision table covers frequent interface patterns and the recommended semantics.

PatternRecommended semanticsKey requirement
Clickable icon that opens a panelNative button with aria-expandedAccessible name for the icon
Tabbed content panelstablist, tab, tabpanelArrow keys and roving tabindex
Modal confirmation windowdialog or alertdialogFocus trap and focus return
Form error summaryalert for urgent messagesInsert content after page load
Site-wide header regionNative header as bannerOnly one banner per page
Decorative imageEmpty alt or role="presentation"Hidden from screen readers
Role choices for common interface patterns

After applying a role, teams should verify the result in the accessibility tree using browser developer tools and test with at least one real screen reader. Automated tools such as WAVE or Pa11y catch invalid role values and missing required children, but they cannot confirm that keyboard interaction matches the announced role.

Common mistakes with ARIA roles

Incorrect roles are often worse than no ARIA at all, because they promise behavior that the component does not deliver. Large accessibility surveys of public websites consistently find that pages using ARIA tend to have more detected errors, largely due to the misuse patterns below.

  • Role without keyboard support: role="button" on a div that responds only to mouse clicks leaves keyboard users stranded.
  • Overriding native semantics: role="heading" on a button destroys the button role that users relied on.
  • Using `role=”menu”` for site navigation: application menus expect arrow-key navigation, whereas ordinary link lists do not.
  • Hiding focusable content: role="presentation" or aria-hidden on an element that still receives focus creates silent focus stops.
  • Misspelled or invented roles: browsers ignore unknown values, so the element silently falls back to its implicit role.

A non-technical view

People who are blind often use a screen reader, software that reads a web page aloud. To be useful, it must say not only the words on the page but also what each thing is: a button, a link, a menu or a pop-up window.

An ARIA role is a label hidden in the code that tells the screen reader what an element is when the page itself does not make it clear. It works like a name tag at a conference. The tag tells you someone is the speaker, but it does not make that person able to speak. The key takeaway is that the label must match how the element really behaves, or it misleads the very people it is meant to help.

A concrete example

A municipal website offers an online permit form with a custom date picker and a set of tabs for applicant, property and payment details. During an accessibility audit, a tester using NVDA hears the tabs announced only as “clickable” text and cannot reach the date picker with the keyboard at all.

The development team rebuilds the tabs with role="tablist", role="tab" and role="tabpanel", adds aria-selected states and implements arrow-key navigation with roving tabindex. For the date picker, they decide that a native input type="date" meets the requirements, which removes about 200 lines of custom JavaScript and the need for any role.

The outcome is a form that screen reader users can now complete independently. Retesting with NVDA and VoiceOver confirms that each tab is announced as “tab, 2 of 3, selected”, and the number of support calls from residents asking for help with the form drops noticeably in the following quarter.