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
<button id="categories" type="button" aria-expanded="مفتوح">التصنيفات</button>
<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-pressedandaria-checkedtaketrueandfalse, in English, whatever the page's language; the label is what is written in Arabic.- A custom control with
role="switch",role="tab"orrole="progressbar"needs a name: visible text,aria-labeloraria-labelledby. - Do not put
aria-hidden="true"on anything that can be focused, or on<body>.
How we detect
- 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 andaria-hidden-focusandaria-hidden-body. - Each element is reported once per axe rule, with the engines that found it.
- axe's ARIA rules that are best practices only (
aria-allowed-role,aria-dialog-name,aria-text,aria-treeitem-name) do not run.