Skip to content

ARIA that says what is not so

a11y-aria-invalidserious
On this page

Why it matters

  • ARIA attributes and roles change what a screen reader announces. When they are wrong, it announces the wrong thing, or nothing: a menu that says it is open when it is closed, a tab list without its tabs, a switch without a name.
  • Browsers do not check ARIA; the visual page looks fine, and only people who use assistive technology meet the fault.
  • WCAG 2.2 asks that every control expose its name, role and state correctly (success criterion 4.1.2, level A), and that the structure the page shows be in its markup (1.3.1, level A).

Example

Wrong
<button id="categories" type="button" aria-expanded="مفتوح">التصنيفات</button>
Right
<button id="categories" type="button" aria-expanded="false">التصنيفات</button>

How to fix

Use the values the ARIA specification defines, and prefer native elements, which need no ARIA:

html
<button id="categories" type="button" aria-expanded="false">التصنيفات</button>
  • aria-expanded, aria-pressed and aria-checked take true and false, in English, whatever the page's language; the label is what is written in Arabic.
  • A custom control with role="switch", role="tab" or role="progressbar" needs a name: visible text, aria-label or aria-labelledby.
  • Do not put aria-hidden="true" on anything that can be focused, or on <body>.

How we detect

  1. We render the page and run axe-core 4.13.0's ARIA rules that WCAG's criteria back, in each engine: the attribute rules (aria-allowed-attr, aria-valid-attr, aria-valid-attr-value, aria-required-attr, aria-prohibited-attr, aria-conditional-attr), the role rules (aria-roles, aria-deprecated-role, aria-required-children, aria-required-parent), the name rules of custom controls and aria-hidden-focus and aria-hidden-body.
  2. Each element is reported once per axe rule, with the engines that found it.
  3. axe's ARIA rules that are best practices only (aria-allowed-role, aria-dialog-name, aria-text, aria-treeitem-name) do not run.