chore: update roles with interactive info #2517
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The information was taken from https://www.w3.org/TR/html-aria/#allowed-aria-roles-states-and-properties
This is a precursor to #601. From reading the discussion in that issue, there was a lot of concern with false positives of nested roles. For example, a
menuitem
cannot have interactive descendants but is allowed amenu
which could have amenuitem
.To address that, I believe the following algorithm works in all listed cases of that pr:
interactiveDescendant: false
. An interactive role is defined as a role whosecontentTypes
includesinteractive
(this step can be done in a rule matcher)contentTypes
includesflow
, continue to the next descendantcontentTypes
also includesinteractive
then don't loop through its descendants as the algorithm will start again from that descendantcontentTypes
includesinteractive
it failsThis should catch all the issues brought up in the original issue, allowing
menuitems
to havemenu
children as it is both flow and interactive (causing the algorithm to break and start again from there). It should also catch ARIA buttons having nested HTML interactive elements such as anchors or buttons.Reviewer checks
Required fields, to be filled out by PR reviewer(s)