Skip to content
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

Merged
merged 4 commits into from
Oct 12, 2021
Merged

Conversation

WilcoFiers
Copy link
Contributor

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

@WilcoFiers WilcoFiers requested a review from a team as a code owner October 6, 2021 11:32
@WilcoFiers WilcoFiers requested review from straker and dylanb October 6, 2021 11:33
straker
straker previously requested changes Oct 6, 2021
doc/API.md Show resolved Hide resolved
straker
straker previously requested changes Oct 7, 2021
Comment on lines 594 to 595
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)) {
Copy link
Contributor

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.

Suggested change
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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

straker
straker previously approved these changes Oct 8, 2021
@WilcoFiers WilcoFiers merged commit 828e526 into develop Oct 12, 2021
@WilcoFiers WilcoFiers deleted the aaa-tag branch October 12, 2021 08:52
straker pushed a commit that referenced this pull request Oct 18, 2021
* fix: Separate Level AAA rules from A and best-practices

* Don't log use of wcag21aaa as a tag

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants