Add role matches methods #1349
Labels
commons
Issues in the common code (lib/commons)
configuration
rules / checks customisation
feat
New feature or enhancement
Milestone
In axe-core we do a lot of role matching. Instead of writing that code over and over, we should add this role matching capability to
axe.commons.matches()
.I think there are three variations:
matches(node, { semanticRole: 'listitem' })
matches(node, { explicitRole: ['presentation', 'none'] })
matches(node, { implicitRole: 'img' })
The semantic role is the default of
aria.getRole(node)
, the explicitRole isaria.getRole(node, { noImplicit: true })
, and implicitRole isaria.implicitRole(node)
.The reason for calling it
semanticRole
rather thanrole
is to avoid confusion with therole
attribute.The text was updated successfully, but these errors were encountered: