Skip to content

Commit

Permalink
fix(frame-title-unique): Make frame-title-unique reviewOnly and WCAG4…
Browse files Browse the repository at this point in the history
…12 (#3610)

* add tags: wcag412 and wcag2a
* remove tag: best-practice
* add "reviewOnFail": true
* fix edge case where reviewOnFail did not result in after function setting results properly

references: #3487
  • Loading branch information
dbowling authored Aug 24, 2022
1 parent a2c2d2f commit 8401b8e
Show file tree
Hide file tree
Showing 7 changed files with 387 additions and 227 deletions.
2 changes: 1 addition & 1 deletion doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
| [duplicate-id](https://dequeuniversity.com/rules/axe/4.4/duplicate-id?application=RuleDescription) | Ensures every id attribute value is unique | Minor | cat.parsing, wcag2a, wcag411 | failure | [3ea0c8](https://act-rules.github.io/rules/3ea0c8) |
| [form-field-multiple-labels](https://dequeuniversity.com/rules/axe/4.4/form-field-multiple-labels?application=RuleDescription) | Ensures form field does not have multiple label elements | Moderate | cat.forms, wcag2a, wcag332 | needs review | |
| [frame-focusable-content](https://dequeuniversity.com/rules/axe/4.4/frame-focusable-content?application=RuleDescription) | Ensures <frame> and <iframe> elements with focusable content do not have tabindex=-1 | Serious | cat.keyboard, wcag2a, wcag211 | failure, needs review | [akn7bn](https://act-rules.github.io/rules/akn7bn) |
| [frame-title-unique](https://dequeuniversity.com/rules/axe/4.4/frame-title-unique?application=RuleDescription) | Ensures <iframe> and <frame> elements contain a unique title attribute | Serious | cat.text-alternatives, wcag412, wcag2a | needs review | [4b1c6c](https://act-rules.github.io/rules/4b1c6c) |
| [frame-title](https://dequeuniversity.com/rules/axe/4.4/frame-title?application=RuleDescription) | Ensures <iframe> and <frame> elements have an accessible name | Serious | cat.text-alternatives, wcag2a, wcag412, section508, section508.22.i | failure, needs review | [cae760](https://act-rules.github.io/rules/cae760) |
| [html-has-lang](https://dequeuniversity.com/rules/axe/4.4/html-has-lang?application=RuleDescription) | Ensures every HTML document has a lang attribute | Serious | cat.language, wcag2a, wcag311, ACT | failure | [b5c3f8](https://act-rules.github.io/rules/b5c3f8) |
| [html-lang-valid](https://dequeuniversity.com/rules/axe/4.4/html-lang-valid?application=RuleDescription) | Ensures the lang attribute of the <html> element has a valid value | Serious | cat.language, wcag2a, wcag311, ACT | failure | [bf051a](https://act-rules.github.io/rules/bf051a) |
Expand Down Expand Up @@ -90,7 +91,6 @@ Rules that do not necessarily conform to WCAG success criterion but are industry
| [empty-heading](https://dequeuniversity.com/rules/axe/4.4/empty-heading?application=RuleDescription) | Ensures headings have discernible text | Minor | cat.name-role-value, best-practice | failure, needs review | [ffd0e9](https://act-rules.github.io/rules/ffd0e9) |
| [empty-table-header](https://dequeuniversity.com/rules/axe/4.4/empty-table-header?application=RuleDescription) | Ensures table headers have discernible text | Minor | cat.name-role-value, best-practice | failure, needs review | |
| [frame-tested](https://dequeuniversity.com/rules/axe/4.4/frame-tested?application=RuleDescription) | Ensures <iframe> and <frame> elements contain the axe-core script | Critical | cat.structure, review-item, best-practice | failure, needs review | |
| [frame-title-unique](https://dequeuniversity.com/rules/axe/4.4/frame-title-unique?application=RuleDescription) | Ensures <iframe> and <frame> elements contain a unique title attribute | Serious | cat.text-alternatives, best-practice | failure | [4b1c6c](https://act-rules.github.io/rules/4b1c6c) |
| [heading-order](https://dequeuniversity.com/rules/axe/4.4/heading-order?application=RuleDescription) | Ensures the order of headings is semantically correct | Moderate | cat.semantics, best-practice | failure, needs review | |
| [image-redundant-alt](https://dequeuniversity.com/rules/axe/4.4/image-redundant-alt?application=RuleDescription) | Ensure image alternative is not repeated as text | Minor | cat.text-alternatives, best-practice | failure | |
| [label-title-only](https://dequeuniversity.com/rules/axe/4.4/label-title-only?application=RuleDescription) | Ensures that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes | Serious | cat.forms, best-practice | failure | |
Expand Down
16 changes: 16 additions & 0 deletions lib/core/base/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,22 @@ Rule.prototype.after = function after(result, options) {
var option = getCheckOption(check, ruleID, options);

var afterResults = check.after(beforeResults, option);

if (this.reviewOnFail) {
afterResults.forEach(checkResult => {
const changeAnyAllResults =
(this.any.includes(checkResult.id) ||
this.all.includes(checkResult.id)) &&
checkResult.result === false;
const changeNoneResult =
this.none.includes(checkResult.id) && checkResult.result === true;

if (changeAnyAllResults || changeNoneResult) {
checkResult.result = undefined;
}
});
}

beforeResults.forEach(item => {
// only add the node property for the check.after so we can
// look at which iframe a check result came from, but we don't
Expand Down
7 changes: 4 additions & 3 deletions lib/rules/frame-title-unique.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"id": "frame-title-unique",
"selector": "frame[title], iframe[title]",
"matches": "frame-title-has-text-matches",
"tags": ["cat.text-alternatives", "best-practice"],
"tags": ["cat.text-alternatives", "wcag412", "wcag2a"],
"actIds": ["4b1c6c"],
"metadata": {
"description": "Ensures <iframe> and <frame> elements contain a unique title attribute",
"help": "Frames should have a unique title attribute"
"help": "Frames must have a unique title attribute"
},
"all": [],
"any": [],
"none": ["unique-frame-title"]
"none": ["unique-frame-title"],
"reviewOnFail": true
}
2 changes: 1 addition & 1 deletion locales/_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
},
"frame-title-unique": {
"description": "Ensures <iframe> and <frame> elements contain a unique title attribute",
"help": "Frames should have a unique title attribute"
"help": "Frames must have a unique title attribute"
},
"frame-title": {
"description": "Ensures <iframe> and <frame> elements have an accessible name",
Expand Down
Loading

0 comments on commit 8401b8e

Please sign in to comment.