-
Notifications
You must be signed in to change notification settings - Fork 890
Support fallback roles #3768
Copy link
Copy link
Open
Labels
commonsIssues in the common code (lib/commons)Issues in the common code (lib/commons)coreIssues in the core code (lib/core)Issues in the core code (lib/core)fixBug fixesBug fixesrulesIssue or false result from an axe-core ruleIssue or false result from an axe-core rulesupport
Milestone
Metadata
Metadata
Assignees
Labels
commonsIssues in the common code (lib/commons)Issues in the common code (lib/commons)coreIssues in the core code (lib/core)Issues in the core code (lib/core)fixBug fixesBug fixesrulesIssue or false result from an axe-core ruleIssue or false result from an axe-core rulesupport
Type
Fields
Give feedbackNo fields configured for issues without a type.
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 examplerole="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
fallbackflag 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 anoptionobject for matcher methods, and add anexplicit-role-matchesmethod.