Skip to content

Commit bc33f4c

Browse files
authored
feat(tap): some best practice rules map to RGAA (#4895)
Mark the following best practice rules as part of RGAA: - focus-order-semantics (experimental) - region - skip-link - table-duplicate-name
1 parent 670be64 commit bc33f4c

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

build/tasks/validate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ function findTagIssues(tags) {
405405
standardTag: standardTags[0] ?? null,
406406
criterionTags
407407
};
408-
if (bestPracticeTags.length !== 0) {
408+
if (name !== 'RGAA' && bestPracticeTags.length !== 0) {
409409
issues.push(`${name} tags cannot be used along side best-practice tag`);
410410
}
411411
if (standardTags.length === 0) {
@@ -417,7 +417,7 @@ function findTagIssues(tags) {
417417
issues.push(`Expected at least one ${name} criterion tag, got 0`);
418418
}
419419

420-
if (wcagLevelRegex) {
420+
if (wcagLevelRegex && standards.WCAG) {
421421
const wcagLevel = standards.WCAG.standardTag;
422422
if (!wcagLevel.match(wcagLevelRegex)) {
423423
issues.push(`${name} rules not allowed on ${wcagLevel}`);

lib/rules/focus-order-semantics.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
"impact": "minor",
44
"selector": "div, h1, h2, h3, h4, h5, h6, [role=heading], p, span",
55
"matches": "inserted-into-focus-order-matches",
6-
"tags": ["cat.keyboard", "best-practice", "experimental"],
6+
"tags": [
7+
"cat.keyboard",
8+
"best-practice",
9+
"RGAAv4",
10+
"RGAA-12.8.1",
11+
"experimental"
12+
],
713
"metadata": {
814
"description": "Ensure elements in the focus order have a role appropriate for interactive content",
915
"help": "Elements in the focus order should have an appropriate role"

lib/rules/region.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "region",
33
"impact": "moderate",
44
"selector": "body *",
5-
"tags": ["cat.keyboard", "best-practice"],
5+
"tags": ["cat.keyboard", "best-practice", "RGAAv4", "RGAA-9.2.1"],
66
"metadata": {
77
"description": "Ensure all page content is contained by landmarks",
88
"help": "All page content should be contained by landmarks"

lib/rules/skip-link.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"impact": "moderate",
44
"selector": "a[href^=\"#\"], a[href^=\"/#\"]",
55
"matches": "skip-link-matches",
6-
"tags": ["cat.keyboard", "best-practice"],
6+
"tags": ["cat.keyboard", "best-practice", "RGAAv4", "RGAA-12.7.1"],
77
"metadata": {
88
"description": "Ensure all skip links have a focusable target",
99
"help": "The skip-link target should exist and be focusable"

lib/rules/table-duplicate-name.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "table-duplicate-name",
33
"impact": "minor",
44
"selector": "table",
5-
"tags": ["cat.tables", "best-practice"],
5+
"tags": ["cat.tables", "best-practice", "RGAAv4", "RGAA-5.2.1"],
66
"metadata": {
77
"description": "Ensure the <caption> element does not contain the same text as the summary attribute",
88
"help": "Tables should not have the same summary and caption"

0 commit comments

Comments
 (0)