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

feat(rule): add ACT Rule IDs to test rule objects #2866

Merged
merged 3 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions build/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var axeVersion = packageJSON.version.substring(
);

var descriptionTableHeader =
'| Rule ID | Description | Impact | Tags | Issue Type |\n| :------- | :------- | :------- | :------- | :------- |\n';
'| Rule ID | Description | Impact | Tags | Issue Type | ACT Rules |\n| :------- | :------- | :------- | :------- | :------- | :------- |\n';

dot.templateSettings.strip = false;

Expand Down Expand Up @@ -301,6 +301,15 @@ function buildRules(grunt, options, commons, callback) {
);
}

function createActLinksForRule(rule) {
var actIds = rule.actIds || [];
var actLinks = [];
actIds.forEach(id =>
actLinks.push(`[${id}](https://act-rules.github.io/rules/${id})`)
);
return actLinks.join(', ');
}

rules.map(function(rule) {
var impact = parseImpactForRule(rule);
var canFail = parseFailureForRule(rule);
Expand Down Expand Up @@ -334,12 +343,15 @@ function buildRules(grunt, options, commons, callback) {
issueType.push('needs review');
}

var actLinks = createActLinksForRule(rule);

rules.push([
`[${rule.id}](https://dequeuniversity.com/rules/axe/${axeVersion}/${rule.id}?application=RuleDescription)`,
entities.encode(rule.metadata.description),
impact,
rule.tags.join(', '),
issueType.join(', ')
issueType.join(', '),
actLinks
]);
if (tags.length) {
rule.enabled = !!rule.tags.filter(function(t) {
Expand Down
6 changes: 6 additions & 0 deletions build/tasks/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ function createSchemas() {
conform: 'must include a category tag'
}
},
actIds: {
type: 'array',
items: {
type: 'string'
}
},
matches: {
type: 'string',
required: false,
Expand Down
208 changes: 104 additions & 104 deletions doc/rule-descriptions.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/rules/area-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["c487ae"],
"metadata": {
"description": "Ensures <area> elements of image maps have alternate text",
"help": "Active <area> elements must have alternate text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-allowed-attr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "aria-allowed-attr",
"matches": "aria-allowed-attr-matches",
"tags": ["cat.aria", "wcag2a", "wcag412"],
"actIds": ["5c01ea"],
"metadata": {
"description": "Ensures ARIA attributes are allowed for an element's role",
"help": "Elements must only use allowed ARIA attributes"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-command-name.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "[role=\"link\"], [role=\"button\"], [role=\"menuitem\"]",
"matches": "no-naming-method-matches",
"tags": ["cat.aria", "wcag2a", "wcag412"],
"actIds": ["97a4e1"],
"metadata": {
"description": "Ensures every ARIA button, link and menuitem has an accessible name",
"help": "ARIA commands must have an accessible name"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-hidden-focus.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"matches": "aria-hidden-focus-matches",
"excludeHidden": false,
"tags": ["cat.name-role-value", "wcag2a", "wcag412", "wcag131"],
"actIds": ["6cfa84"],
"metadata": {
"description": "Ensures aria-hidden elements do not contain focusable elements",
"help": "ARIA hidden element must not contain focusable elements"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-input-field-name.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "[role=\"combobox\"], [role=\"listbox\"], [role=\"searchbox\"], [role=\"slider\"], [role=\"spinbutton\"], [role=\"textbox\"]",
"matches": "no-naming-method-matches",
"tags": ["cat.aria", "wcag2a", "wcag412", "ACT"],
"actIds": ["e086e5"],
"metadata": {
"description": "Ensures every ARIA input field has an accessible name",
"help": "ARIA input fields must have an accessible name"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-required-children.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "[role]",
"matches": "aria-required-children-matches",
"tags": ["cat.aria", "wcag2a", "wcag131"],
"actIds": ["ff89c9"],
"metadata": {
"description": "Ensures elements with an ARIA role that require child roles contain them",
"help": "Certain ARIA roles must contain particular children"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-required-parent.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "[role]",
"matches": "aria-required-parent-matches",
"tags": ["cat.aria", "wcag2a", "wcag131"],
"actIds": ["bc4a75", "ff89c9"],
"metadata": {
"description": "Ensures elements with an ARIA role that require parent roles are contained by them",
"help": "Certain ARIA roles must be contained by particular parents"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/aria-valid-attr-value.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "aria-valid-attr-value",
"matches": "aria-has-attr-matches",
"tags": ["cat.aria", "wcag2a", "wcag412"],
"actIds": ["5c01ea", "c487ae"],
"metadata": {
"description": "Ensures all ARIA attributes have valid values",
"help": "ARIA attributes must conform to valid values"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/audio-caption.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508",
"section508.22.a"
],
"actIds": ["c3232f", "e7aa44"],
"metadata": {
"description": "Ensures <audio> elements have captions",
"help": "<audio> elements must have a captions track"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/autocomplete-valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "autocomplete-valid",
"matches": "autocomplete-matches",
"tags": ["cat.forms", "wcag21aa", "wcag135"],
"actIds": ["73f2c2"],
"metadata": {
"description": "Ensure the autocomplete attribute is correct and suitable for the form field",
"help": "autocomplete attribute must be used correctly"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/button-name.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["97a4e1", "m6b1q3"],
"metadata": {
"description": "Ensures buttons have discernible text",
"help": "Buttons must have discernible text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/css-orientation-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "css-orientation-lock",
"selector": "html",
"tags": ["cat.structure", "wcag134", "wcag21aa", "experimental"],
"actIds": ["b33eff"],
"metadata": {
"description": "Ensures content is not locked to any specific display orientation, and the content is operable in all display orientations",
"help": "CSS Media queries are not used to lock display orientation"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/document-title.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "html",
"matches": "is-initiator-matches",
"tags": ["cat.text-alternatives", "wcag2a", "wcag242", "ACT"],
"actIds": ["2779a5"],
"metadata": {
"description": "Ensures each HTML document contains a non-empty <title> element",
"help": "Documents must have <title> element to aid in navigation"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/duplicate-id-aria.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"matches": "duplicate-id-aria-matches",
"excludeHidden": false,
"tags": ["cat.parsing", "wcag2a", "wcag411"],
"actIds": ["3ea0c8"],
"metadata": {
"description": "Ensures every id attribute value used in ARIA and in labels is unique",
"help": "IDs used in ARIA and labels must be unique"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/html-has-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "html",
"matches": "is-initiator-matches",
"tags": ["cat.language", "wcag2a", "wcag311", "ACT"],
"actIds": ["b5c3f8"],
"metadata": {
"description": "Ensures every HTML document has a lang attribute",
"help": "<html> element must have a lang attribute"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/html-lang-valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "html-lang-valid",
"selector": "html[lang], html[xml\\:lang]",
"tags": ["cat.language", "wcag2a", "wcag311", "ACT"],
"actIds": ["bf051a"],
"metadata": {
"description": "Ensures the lang attribute of the <html> element has a valid value",
"help": "<html> element must have a valid value for the lang attribute"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/html-xml-lang-mismatch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "html[lang][xml\\:lang]",
"matches": "xml-lang-mismatch-matches",
"tags": ["cat.language", "wcag2a", "wcag311", "ACT"],
"actIds": ["5b7ae0"],
"metadata": {
"description": "Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page",
"help": "HTML elements with lang and xml:lang must have the same base language"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/identical-links-same-purpose.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"excludeHidden": false,
"matches": "identical-links-same-purpose-matches",
"tags": ["cat.semantics", "wcag2aaa", "wcag249", "best-practice"],
"actIds": ["b20e66", "fd3a94"],
"metadata": {
"description": "Ensure that links with the same accessible name serve a similar purpose",
"help": "Links with the same name have a similar purpose"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/image-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["23a2a8"],
"metadata": {
"description": "Ensures <img> elements have alternate text or a role of none or presentation",
"help": "Images must have alternate text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/input-image-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["59796f"],
"metadata": {
"description": "Ensures <input type=\"image\"> elements have alternate text",
"help": "Image buttons must have alternate text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/label-content-name-mismatch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "label-content-name-mismatch",
"matches": "label-content-name-mismatch-matches",
"tags": ["cat.semantics", "wcag21a", "wcag253", "experimental"],
"actIds": ["2ee8b8"],
"metadata": {
"description": "Ensures that elements labelled through their content must have their visible text as part of their accessible name",
"help": "Elements must have their visible text as part of their accessible name"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/label.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"section508.22.n",
"ACT"
],
"actIds": ["e086e5", "307n5z"],
"metadata": {
"description": "Ensures every form element has a label",
"help": "Form elements must have labels"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/link-name.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["c487ae"],
"metadata": {
"description": "Ensures links have discernible text",
"help": "Links must have discernible text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/meta-viewport.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "meta[name=\"viewport\"]",
"excludeHidden": false,
"tags": ["cat.sensory-and-visual-cues", "best-practice", "ACT"],
"actIds": ["b4f0c3"],
"metadata": {
"description": "Ensures <meta name=\"viewport\"> does not disable text scaling and zooming",
"help": "Zooming and scaling should not be disabled"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/nested-interactive.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "nested-interactive",
"matches": "nested-interactive-matches",
"tags": ["cat.keyboard", "wcag2a", "wcag412"],
"actIds": ["307n5z"],
"metadata": {
"description": "Nested interactive controls are not announced by screen readers",
"help": "Ensure interactive controls are not nested"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-autoplay-audio.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"selector": "audio[autoplay], video[autoplay]",
"matches": "no-autoplay-audio-matches",
"tags": ["cat.time-and-media", "wcag2a", "wcag142", "experimental"],
"actIds": ["80f0bf"],
"metadata": {
"description": "Ensures <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio",
"help": "<video> or <audio> elements do not autoplay audio"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/object-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"section508",
"section508.22.a"
],
"actIds": ["8fc3b6"],
"metadata": {
"description": "Ensures <object> elements have alternate text",
"help": "<object> elements must have alternate text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/role-img-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["23a2a8"],
"metadata": {
"description": "Ensures [role='img'] elements have alternate text",
"help": "[role='img'] elements have an alternative text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/scrollable-region-focusable.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "scrollable-region-focusable",
"matches": "scrollable-region-focusable-matches",
"tags": ["cat.keyboard", "wcag2a", "wcag211"],
"actIds": ["0ssw9k"],
"metadata": {
"description": "Elements that have scrollable content must be accessible by keyboard",
"help": "Ensure that scrollable region has keyboard access"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/select-name.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.n",
"ACT"
],
"actIds": ["e086e5"],
"metadata": {
"description": "Ensures select element has an accessible name",
"help": "Select element must have an accessible name"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/svg-img-alt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"section508.22.a",
"ACT"
],
"actIds": ["7d6734"],
"metadata": {
"description": "Ensures svg elements with an img, graphics-document or graphics-symbol role have an accessible text",
"help": "svg elements with an img role have an alternative text"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/td-headers-attr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "td-headers-attr",
"selector": "table",
"tags": ["cat.tables", "wcag2a", "wcag131", "section508", "section508.22.g"],
"actIds": ["a25f45"],
"metadata": {
"description": "Ensure that each cell in a table using the headers refers to another cell in that table",
"help": "All cells in a table element that use the headers attribute must only refer to other cells of that same table"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/th-has-data-cells.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "table",
"matches": "data-table-matches",
"tags": ["cat.tables", "wcag2a", "wcag131", "section508", "section508.22.g"],
"actIds": ["d0f69e"],
"metadata": {
"description": "Ensure that each table header in a data table refers to data cells",
"help": "All th elements and elements with role=columnheader/rowheader must have data cells they describe"
Expand Down
1 change: 1 addition & 0 deletions lib/rules/video-caption.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"section508",
"section508.22.a"
],
"actIds": ["eac66b"],
"metadata": {
"description": "Ensures <video> elements have captions",
"help": "<video> elements must have captions"
Expand Down