aria-label-misuse
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...<svg focusable="false"></svg>...<div aria-label="x">y</div>...<a aria-label="x">y</a><a href="x" aria-label="x">y</a>...Configuration
Section titled “Configuration”angular: lint: rules: aria-label-misuse: warn # off (default), warn, errorhtml: lint: rules: aria-label-misuse: warn # off (default), warn, errorsvelte: lint: rules: aria-label-misuse: warn # off (default), warn, errorvue: lint: rules: aria-label-misuse: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |