Skip to content

aria-label-misuse

Reports an aria-label on an element that cannot be named by it: a generic element (<div>, <span>, <p>, <b>, …) with no role, and an <a> without href. Interactive elements, landmarks and elements with a role are not reported.

Assistive technology ignores a label on an element that has no role, so the text is never read, and the author believes the element is described when it is not.

To fix, give the element a role (or use a native element that has one), or move the text into the content.

Reported
...
<svg focusable="false"></svg>
...
<div aria-label="x">y</div>
...
<a aria-label="x">y</a>
<a href="x" aria-label="x">y</a>
...
angular:
lint:
rules:
aria-label-misuse: warn # off (default), warn, error
html:
lint:
rules:
aria-label-misuse: warn # off (default), warn, error
svelte:
lint:
rules:
aria-label-misuse: warn # off (default), warn, error
vue:
lint:
rules:
aria-label-misuse: warn # off (default), warn, error

Enabled by the presets: html/html-validate-standard.

Suppress one line with sudsy-disable-next-line aria-label-misuse in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-validate aria-label-misuse partial generic elements and a without href; the strictly-allowed-but-not-recommended cases and allowAnyNamable are not reported