Skip to main content
Accessibility

ARIA (Accessible Rich Internet Applications)

Published:
Updated:

ARIA (Accessible Rich Internet Applications, formally WAI-ARIA) is a W3C specification defining a set of attributes that extend HTML with semantics understandable to assistive technologies. Attributes like role, aria-label, aria-expanded or aria-live tell a screen reader what an element is, what it is called and what state it is in.

ARIA adds component semantics but not behavior. Start with HTML when button, details or input provides the needed function. Custom widgets still require keyboard handling, focus management and state logic.

The five rules of ARIA use

  • The first rule of ARIA: don't use ARIA if a native HTML element exists (button, nav, details).
  • Don't change native semantics unnecessarily (e.g. <button role="heading">).
  • Every interactive element with an ARIA role must be keyboard operable.
  • Don't hide focusable elements with role="presentation" or aria-hidden="true".
  • Every interactive element must have an accessible name.

Most common mistakes

Typical errors include aria-expanded disagreeing with panel visibility, an accessible name that does not match the visible label, and aria-hidden on a focusable element. Inspect the accessibility tree and component behavior, not merely attribute presence.

Example

A complete panel toggle: the native button supports Enter and Space, while the script keeps hidden and aria-expanded synchronized. Inspect the accessibility tree for the button name, expanded state and controls relationship.

Button and synchronized state
HTML
<button id="faq-toggle" type="button" aria-expanded="false" aria-controls="faq-panel">
  Show answer
</button>
<div id="faq-panel" hidden>Answer content.</div>
<script>
  const toggle = document.querySelector('#faq-toggle');
  const panel = document.querySelector('#faq-panel');
  toggle.addEventListener('click', () => {
    const expanded = toggle.getAttribute('aria-expanded') === 'true';
    toggle.setAttribute('aria-expanded', String(!expanded));
    panel.hidden = expanded;
  });
</script>

Sources & further reading

Check your site accessibility

Insight runs automated tests for selected WCAG-based accessibility rules and ranks detected issues by priority.