-
Notifications
You must be signed in to change notification settings - Fork 788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Separate Level AAA rules from A and best-practices #3191
Conversation
lib/core/base/audit.js
Outdated
const unmatchedTags = only.values.filter(tag => !tags.includes(tag)); | ||
if (unmatchedTags.length !== 0) { | ||
log('Could not find tags `' + unmatchedTags.join('`, `') + '`'); | ||
if (unmatchedTags.length !== 0 && !/wcag2[1-3]a{1,3}/.test(unmatchedTags)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hides all other unknown tags, so passing this would not log that foo
is an unknown tag:
axe.run({ runOnly: ['wcag23a', 'foo'] });
We should instead filter out the wcag tags from the unmatched ones.
const unmatchedTags = only.values.filter(tag => !tags.includes(tag)); | |
if (unmatchedTags.length !== 0) { | |
log('Could not find tags `' + unmatchedTags.join('`, `') + '`'); | |
if (unmatchedTags.length !== 0 && !/wcag2[1-3]a{1,3}/.test(unmatchedTags)) { | |
const unmatchedTags = only.values.filter(tag => !tags.includes(tag) && !/wcag2[1-3]a{1,3}/.test(tag)); | |
if (unmatchedTags.length !== 0) { |
Also add a test to show this still reports unknown tags when used with an allowed wcag tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
* fix: Separate Level AAA rules from A and best-practices * Don't log use of wcag21aaa as a tag * address comments
Per Dylan's suggestion, and according to our own API docs the AAA tag should never have been used on rules tagged at a different level, or as best practice. This PR puts ensures AAA rules are now treated as its own "type" or rule.
Closes issue: #3190