squirrelscan
GitHub

Required ARIA attributes for a role, and what is missing

role=checkbox with no aria-checked has a state screen readers cannot read. squirrel checks the roles whose attributes are mandatory.

What a required ARIA attribute is

A role tells assistive technology what an element is. Some roles also need a state or property before they mean anything: a checkbox that never says whether it is checked, a slider that never reports its position, a heading with no level.

Native HTML supplies these on its own. <input type="checkbox"> carries its checked state in the DOM. The moment you build the same control out of a <div> and a role, you own the state as well.

What squirrel checks

One check, aria-required-attr, at severity error. It reads every element with a role, takes the first token of the attribute, and looks it up in a table of roles and their required attributes:

RoleRequired
checkbox, radio, switcharia-checked
comboboxaria-expanded
headingaria-level
meter, slideraria-valuenow
optionaria-selected
scrollbararia-controls, aria-valuenow

separator and spinbutton are in the table with nothing required, so they never produce a finding.

  • Fail with N element(s) missing required ARIA attributes. Items read div[role="checkbox"]: missing aria-checked, up to ten with a count of the rest.
  • Pass with All elements have required ARIA attributes.
  • Info with No elements with ARIA roles found.

The check tests presence, not value, so aria-checked="" satisfies it. Whether the value is legal is a11y/aria-valid-attr-value.

How to fix it

<div role="checkbox" aria-checked="false" tabindex="0">
  Email me about new releases
</div>

Keep the attribute in step with the visible state in your event handler, or the announcement drifts away from the control.

In a role fallback chain such as role="doc-subtitle heading", squirrel looks up only the first token. A chain whose first entry is unrecognized is therefore not checked against the second.

Rule IDa11y/aria-required-attr
CategoryAccessibility
ScopePer-page
Severityerror
Weight7/10

Enable / disable

Disable this rule

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

Disable all Accessibility rules

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

Enable only this rule

[rules]
enable = ["a11y/aria-required-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 element is listed with the role it declares and the attribute it is missing. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close