Skip to content

Commit

Permalink
Upgrade to WCAG 2.2 (#33)
Browse files Browse the repository at this point in the history
* Upgrade to WCAG 2.2

* Tweak
  • Loading branch information
WilcoFiers authored Aug 8, 2024
1 parent cc2208a commit b611ae1
Show file tree
Hide file tree
Showing 14 changed files with 568 additions and 474 deletions.
2 changes: 1 addition & 1 deletion src/EarlReport/context.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const context = {
"@vocab": "http://www.w3.org/ns/earl#",
earl: "http://www.w3.org/ns/earl#",
WCAG2: "http://www.w3.org/TR/WCAG21/#",
WCAG2: "http://www.w3.org/TR/WCAG22/#",
dct: "http://purl.org/dc/terms/",
sch: "https://schema.org/",
testRuns: "@graph",
Expand Down
4 changes: 2 additions & 2 deletions src/act/__tests__/get-accessibility-requirement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("getAccessibilityRequirement", () => {
title:
"H2: Combining adjacent image and text links for the same resource",
shortTitle: "technique H2",
url: "https://www.w3.org/WAI/WCAG21/Techniques/html/H2",
url: "https://www.w3.org/WAI/WCAG22/Techniques/html/H2",
});
});

Expand All @@ -23,7 +23,7 @@ describe("getAccessibilityRequirement", () => {
requirementType: "success criterion",
title: "1.1.1 Non-text Content (Level A)",
shortTitle: "1.1.1 Non-text Content",
url: "https://www.w3.org/TR/WCAG21/#non-text-content",
url: "https://www.w3.org/TR/WCAG22/#non-text-content",
});
});

Expand Down
21 changes: 16 additions & 5 deletions src/act/accessibility-requirements/__tests__/get-wcag-criterion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,29 @@ describe("getWcagCriterion", () => {
conformanceLevel: "WCAG 2.0 and later on level A and higher",
title: "1.1.1 Non-text Content (Level A)",
shortTitle: "1.1.1 Non-text Content",
url: "https://www.w3.org/TR/WCAG21/#non-text-content",
url: "https://www.w3.org/TR/WCAG22/#non-text-content",
});
});

it("returns a criterion for WCAG 2.1 level AA", () => {
const criterion = getWcagCriterion("1.3.4");
expect(criterion).toEqual({
requirementType: "success criterion",
conformanceLevel: "WCAG 2.1 on level AA and higher",
conformanceLevel: "WCAG 2.1 and later on level AA and higher",
title: "1.3.4 Orientation (Level AA)",
shortTitle: "1.3.4 Orientation",
url: "https://www.w3.org/TR/WCAG21/#orientation",
url: "https://www.w3.org/TR/WCAG22/#orientation",
});
});

it("returns a criterion for WCAG 2.2 level AA", () => {
const criterion = getWcagCriterion("2.5.8");
expect(criterion).toEqual({
requirementType: "success criterion",
conformanceLevel: "WCAG 2.2 on level AA and higher",
title: "2.5.8 Target Size (Minimum) (Level AA)",
shortTitle: "2.5.8 Target Size (Minimum)",
url: "https://www.w3.org/TR/WCAG22/#target-size-minimum",
});
});

Expand All @@ -30,7 +41,7 @@ describe("getWcagCriterion", () => {
conformanceLevel: "WCAG 2.0 and later on level AAA",
title: "1.2.9 Audio-only (Live) (Level AAA)",
shortTitle: "1.2.9 Audio-only (Live)",
url: "https://www.w3.org/TR/WCAG21/#audio-only-live",
url: "https://www.w3.org/TR/WCAG22/#audio-only-live",
});
});

Expand All @@ -39,7 +50,7 @@ describe("getWcagCriterion", () => {
expect(criterion).toEqual({
requirementType: "success criterion",
title: "0.0.0 Unknown success criterion",
url: "https://www.w3.org/TR/WCAG21/",
url: "https://www.w3.org/TR/WCAG22/",
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("getWcagTechnique", () => {
title:
"H2: Combining adjacent image and text links for the same resource",
shortTitle: "technique H2",
url: "https://www.w3.org/WAI/WCAG21/Techniques/html/H2",
url: "https://www.w3.org/WAI/WCAG22/Techniques/html/H2",
});
});

Expand All @@ -19,7 +19,7 @@ describe("getWcagTechnique", () => {
requirementType: "technique",
title: "H1: Unknown technique",
shortTitle: "technique H1",
url: "https://www.w3.org/WAI/WCAG21/Techniques/#html",
url: "https://www.w3.org/WAI/WCAG22/Techniques/#html",
});
});

Expand All @@ -29,7 +29,7 @@ describe("getWcagTechnique", () => {
requirementType: "technique",
title: "X123: Unknown technique",
shortTitle: "technique X123",
url: "https://www.w3.org/WAI/WCAG21/Techniques/",
url: "https://www.w3.org/WAI/WCAG22/Techniques/",
});
});
});
4 changes: 2 additions & 2 deletions src/act/accessibility-requirements/get-wcag-criterion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type SuccessCriterion = {
const scUrls: Record<string, SuccessCriterion | undefined> = successCriteria;

const requirementType = "success criterion";
const latestWcagVersion = "2.1";
const latestWcagVersion = "2.2";
const highestLevel = "AAA";

// For WCAG SC. Title, URL and more is grabbed from data fetched during build.
Expand Down Expand Up @@ -47,6 +47,6 @@ function fallbackCriterion(scNumber: string) {
return {
requirementType,
title: `${scNumber} Unknown success criterion`,
url: "https://www.w3.org/TR/WCAG21/",
url: "https://www.w3.org/TR/WCAG22/",
};
}
2 changes: 1 addition & 1 deletion src/act/accessibility-requirements/get-wcag-technique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const technologyMap: Record<string, string | undefined> = {
};

function getTechniqueUrl(techniqueId: string): string {
const baseUrl = `https://www.w3.org/WAI/WCAG21/Techniques/`;
const baseUrl = `https://www.w3.org/WAI/WCAG22/Techniques/`;
techniqueId = techniqueId.toUpperCase();
const prefix = techniqueId.replace(/[0-9]/g, "").toLowerCase();
const techniqueType = technologyMap[prefix];
Expand Down
4 changes: 2 additions & 2 deletions src/act/get-accessibility-requirement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const accessibilityDocs: AccessibilityDocuments = {
requirementType: "WAI-ARIA rule",
},
"wcag-text": {
conformanceLevel: "WCAG 2.1",
baseURL: "https://www.w3.org/TR/WCAG21/#",
conformanceLevel: "WCAG 2.2",
baseURL: "https://www.w3.org/TR/WCAG22/#",
requirementType: "WCAG 2 conformance requirement",
},
};
Expand Down
11 changes: 11 additions & 0 deletions src/data/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Data

These data files are maintained by hand.

The technique-titles.json file can be updated by running the following code in the console on the [techniques page](https://www.w3.org/WAI/WCAG22/Techniques/).

```js
JSON.stringify(Object.fromEntries($$('.toc-wcag-docs a').map(a => {
return a.textContent.split(': ').map(t => t.replaceAll(/\s+/g, ' ').trim())
})), null, 2)
```
Loading

0 comments on commit b611ae1

Please sign in to comment.