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:
| Role | Required |
|---|---|
checkbox, radio, switch | aria-checked |
combobox | aria-expanded |
heading | aria-level |
meter, slider | aria-valuenow |
option | aria-selected |
scrollbar | aria-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 readdiv[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 ID | a11y/aria-required-attr |
| Category | Accessibility |
| Scope | Per-page |
| Severity | error |
| Weight | 7/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.
Related rules
- a11y/aria-valid-attr-value: whether the value you supplied is legal for that attribute.
- a11y/aria-required-children: the child roles a container role has to contain.
- a11y/aria-required-parent: the same relationship seen from the child.
- a11y/aria-toggle-field-name: the name those checkbox and switch roles also need.
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.