Valid ARIA Roles
ID |
html.aria_role_valid |
Severity |
high |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Html |
Tags |
accessibility, reliability |
Rationale
An unrecognised role is dropped by the accessibility tree, and the element falls back to the
implicit role of its tag — for a div that is no role at all. The element then looks annotated in
the source and is anonymous to a screen reader, which is worse than never having set a role, because
the author stops looking.
The twelve abstract roles fail the same way for a different reason: they exist to organise the ARIA
taxonomy and are explicitly not for authors, so role="widget" is as inert as a typo while looking
far more deliberate.
<div role="buton">x</div> <!-- FLAW — misspelt, the element keeps no role -->
<div role="widget">x</div> <!-- FLAW — abstract role, never valid in markup -->
<div role="button">x</div> <!-- OK -->
<div role="switch checkbox">x</div> <!-- OK — a fallback list, most specific first -->
<div role="doc-abstract">x</div> <!-- OK — the DPUB-ARIA module vocabulary -->
<div role="${kind}">x</div> <!-- OK — settled at render time, not judged here -->
ARIA allows a whitespace-separated fallback list, most specific first, so every token is judged on
its own and the first bad one is reported. The module vocabularies layered on ARIA, DPUB-ARIA
(doc-) and Graphics ARIA (graphics-), are recognised by prefix rather than enumerated. Role
tokens are matched case-insensitively, as browsers read them.
Only a role written as plain HTML with a literal value is judged: th:role and a value carrying a
template expression are settled at render time, and a namespaced element such as <h:panelGroup> is
a template component rather than the HTML element it resembles.