Description
In axe-core 4.5 we stopped failing elements that use fallback roles in the role attribute. However many places in axe-core still assume fallback roles are not allowed. For example many rule selectors do something like [role="button"]
to select elements with an explicit button role. That wouldn't work for elements with for example role="button img"
, which will not match.
I think we need to do things for this ticket;
-
Go through the code base, and replace all uses of
.getAttribute('role')
/.attr('role')
witharia.getExplicitRole()
-
The
fallback
flag ofaria.getRole()
and its related methods needs to be set to true, and tests need to be added in relevant places that are impacted by this. -
Replace rule selectors that use
[role="??"]
with something that uses the explicit role. There are lots of ways we could do this, so we need to figure out what's the best way to do this first. Some ideas include allowing a custom::axe/explicitRole('button')
selector, allowing the matches property to useaxe.commons.matches()
objects, or maybe adding anoption
object for matcher methods, and add anexplicit-role-matches
method.