Skip to content

Commit

Permalink
feat(commons): Add matches methods (#1270)
Browse files Browse the repository at this point in the history
This PR adds a series of "matches" functions to axe.commons.matches. These functions are designed to allow us to match elements on different types of things. We started doing this for the aria-allowed-role rule, but while working on the accessible name computation I found myself building a very similar thing.

This PR replaces the existing `aria.validateNodeAndAttributes` with a more general purpose axe.commons.matches function.

**Note**, I realise there is a bunch more refactoring that needs to happen. I'd prefer to keep that out of this PR, so that we can get the accessible name PR resolved.

**Note** This PR removes a commons that was introduced in 3.1.0. This is a **breaking change**. I do not think this will impact anyone, and so I didn't put in the time to put some deprecation thing around it, but if anyone thinks this is necessary I can put that in.

This PR is a prerequisite for #1163 

Closes issue: none.

## Reviewer checks

**Required fields, to be filled out by PR reviewer(s)**
- [x] Follows the commit message policy, appropriate for next version
- [x] Has documentation updated, a DU ticket, or requires no documentation change
- [x] Includes new tests, or was unnecessary
- [x] Code is reviewed for security by: @JKODU
  • Loading branch information
WilcoFiers committed Jan 3, 2019
1 parent 0d2cf80 commit 986c97a
Show file tree
Hide file tree
Showing 21 changed files with 1,325 additions and 1,006 deletions.
4 changes: 1 addition & 3 deletions lib/commons/aria/get-element-unallowed-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ aria.getElementUnallowedRoles = function getElementUnallowedRoles(
}

// check if role is allowed on element
if (!aria.isAriaRoleAllowedOnElement(node, role)) {
return true;
}
return !aria.isAriaRoleAllowedOnElement(node, role);
});

return unallowedRoles;
Expand Down
Loading

0 comments on commit 986c97a

Please sign in to comment.