Ramonda

aria-state-the-role-does-not-have

This fails the run. Where it is wrong about your code, // ramonda-check-ignore <reason> on the line says so, and the reason is printed on every run.

Reported when an aria-* sits beside a role that does not support it, so nothing exposes it.

ARIA defines every non-global state as belonging to particular roles and exposes it only there. Written beside a role that does not have it, the attribute lands in the DOM, updates as the state changes, and is announced by nobody.

The answer is usually one word. A toggle built as role="button" with aria-checked wants role="switch"; a list item with aria-selected wants role="option" inside a role="listbox"; a header with aria-sort wants role="columnheader" inside a table.

Where the role really is the right one, the state is the wrong one: a button that opens something uses aria-expanded, and a button that stays pressed uses aria-pressed.

Not every attribute is judged here. Only those whose set of roles is small and settled — and where this is unsure whether a role belongs, it assumes it does, because a missed report is cheaper than a wrong one.

Next