squirrelscan
GitHub

ARIA attributes that are not allowed on an element

role=presentation with an aria-label, or a decorative image with one, contradicts itself. squirrel reports both on every page.

What an allowed ARIA attribute is

Every ARIA role supports a defined set of states and properties, and an attribute outside that set has no effect at best and a wrong effect at worst.

Two combinations contradict themselves outright. role="presentation" and role="none" ask the browser to drop an element’s semantics, and a global ARIA property such as aria-label reverses that request: the specification’s conflict resolution tells the browser to ignore the presentational role and keep the native semantics instead. alt="" marks an image as decorative, so an aria-label on that image says the opposite of the alt.

What squirrel checks

One check, aria-allowed-attr, at severity warning. It walks every element carrying at least one aria-* attribute and reports those two contradictions.

  • An element with role="presentation" or role="none" that also has aria-label, aria-labelledby or aria-describedby. Item text: div[role="presentation"]: aria-label not allowed.
  • An <img> with alt="" that also has aria-label or aria-labelledby. Item text: img[alt=""]: aria-label conflicts with decorative intent.
  • Warn with N element(s) with inappropriate ARIA attributes, listing up to ten items plus a count of the rest.
  • Pass with All ARIA attributes are appropriate for their elements.

The check is deliberately narrow. It does not walk the full role-to-attribute matrix from the ARIA specification, and misspelled attribute names are left to a11y/aria-valid-attr.

How to fix it

<img src="divider.svg" alt="">

<div role="presentation">
  <p>Layout wrapper with no semantics of its own.</p>
</div>

Decide which of the two you meant. If the element carries meaning, drop the presentational role and keep the label. If it does not, drop the label.

Rule IDa11y/aria-allowed-attr
CategoryAccessibility
ScopePer-page
Severitywarning
Weight6/10

Enable / disable

Disable this rule

[rules]
disable = ["a11y/aria-allowed-attr"]

Disable all Accessibility rules

[rules]
disable = ["a11y/*"]

Enable only this rule

[rules]
enable = ["a11y/aria-allowed-attr"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Accessibility section of the report. Each contradiction is listed with the element and the offending attribute. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close