From 9bce7a0a60bd39797a3cd172debde5dfa8f841f9 Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Fri, 15 Sep 2023 10:47:04 +0200 Subject: [PATCH 1/5] Add possibility to link to ARIA in HTML --- .../__tests__/get-accessibility-requirement.ts | 18 ++++++++++++++++++ src/act/get-accessibility-requirement.ts | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/act/__tests__/get-accessibility-requirement.ts b/src/act/__tests__/get-accessibility-requirement.ts index aa63227..e79367c 100644 --- a/src/act/__tests__/get-accessibility-requirement.ts +++ b/src/act/__tests__/get-accessibility-requirement.ts @@ -57,4 +57,22 @@ describe("getAccessibilityRequirement", () => { url: "https://www.w3.org/TR/using-aria/#fourth", }); }); + + it("returns ARIA in HTML requirements", () => { + const fourth = getAccessibilityRequirement({ + requirementId: "html-aria:docconformance", + title: + "ARIA in HTML, 4. Document conformance requirements for use of ARIA attributes in HTML", + }); + + expect(fourth).toEqual({ + conformanceLevel: "ARIA in HTML", + requirementType: "ARIA in HTML requirement", + title: + "ARIA in HTML, 4. Document conformance requirements for use of ARIA attributes in HTML", + shortTitle: + "ARIA in HTML, 4. Document conformance requirements for use of ARIA attributes in HTML", + url: "https://www.w3.org/TR/html-aria/#docconformance", + }); + }); }); diff --git a/src/act/get-accessibility-requirement.ts b/src/act/get-accessibility-requirement.ts index 82275d5..c278f55 100644 --- a/src/act/get-accessibility-requirement.ts +++ b/src/act/get-accessibility-requirement.ts @@ -26,6 +26,11 @@ const accessibilityDocs: AccessibilityDocuments = { baseURL: "https://www.w3.org/TR/graphics-aria-1.0/#", requirementType: "WAI-ARIA Graphics Module requirement", }, + "html-aria": { + conformanceLevel: "ARIA in HTML", + baseURL: "https://www.w3.org/TR/html-aria/#", + requirementType: "ARIA in HTML requirement", + }, "using-aria": { baseURL: "https://www.w3.org/TR/using-aria/#", requirementType: "WAI-ARIA rule", From ce82382e9abd50ee8c03cd8630ba7a2870b9a5ed Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Thu, 28 Sep 2023 10:53:43 +0200 Subject: [PATCH 2/5] Switch from ARIA 1.1 to 1.2 --- src/act/get-accessibility-requirement.ts | 6 +- .../__tests__/get-rule-content.ts | 165 +++++++++++++++++- .../__tests__/get-requirements-map.ts | 6 +- 3 files changed, 168 insertions(+), 9 deletions(-) diff --git a/src/act/get-accessibility-requirement.ts b/src/act/get-accessibility-requirement.ts index c278f55..97a29bc 100644 --- a/src/act/get-accessibility-requirement.ts +++ b/src/act/get-accessibility-requirement.ts @@ -10,9 +10,9 @@ type AccessibilityDocuments = { }; const accessibilityDocs: AccessibilityDocuments = { - aria11: { - conformanceLevel: "WAI-ARIA 1.1 author requirements", - baseURL: "https://www.w3.org/TR/wai-aria-1.1/#", + aria12: { + conformanceLevel: "WAI-ARIA 1.2 author requirements", + baseURL: "https://www.w3.org/TR/wai-aria-1.2/#", requirementType: "WAI-ARIA requirement", }, "dpub-aria": { diff --git a/src/rule-transform/__tests__/get-rule-content.ts b/src/rule-transform/__tests__/get-rule-content.ts index 0bc90d9..38459c4 100644 --- a/src/rule-transform/__tests__/get-rule-content.ts +++ b/src/rule-transform/__tests__/get-rule-content.ts @@ -1,11 +1,11 @@ -import outdent from "outdent"; import moment from "moment"; +import outdent from "outdent"; +import { RulePage } from "../../types"; +import { indent } from "../../utils/index"; import { parsePage } from "../../utils/parse-page"; import { createGlossary } from "../__test-utils"; import { getRuleContent } from "../get-rule-content"; -import { RulePage } from "../../types"; import { getFooter } from "../rule-content/frontmatter/get-footer"; -import { indent } from "../../utils/index"; describe("getRuleContent", () => { const q = "```"; @@ -200,4 +200,163 @@ describe("getRuleContent", () => { ` ); }); + + // Mapping to WCAG SCs adds a scs_tested key to the TF Markdown, which is + // somewhat annoying to handle in bulk. So they are not part of this test + // but are effectively tested as part of the previous one. + it("accept all possible non-WCAG mappings", () => { + const requirements = [ + { + source: `aria12:state_property_processing: + title: ARIA 1.2, 8.6 State and Property Attribute Processing + forConformance: true + failed: not satisfied + passed: satisfied + inapplicable: satisfied`, + expected: outdent` + `, + // { + // source: `wcag-technique:ARIA5: # Using WAI-ARIA state and property attributes to expose the state of a user interface component + // forConformance: false + // failed: not satisfied + // passed: further testing needed + // inapplicable: further testing needed`, + // expected: outdent``, + // }, + }, + // { source: `dpub-aria:`, expected: outdent`` }, + // { source: `graphics-aria`, expected: outdent`` }, + // { source: `html-aria:`, expected: outdent`` }, + // { source: `using-aria:`, expected: outdent`` }, + // { source: `wcag-text:`, expected: outdent`` }, + ]; + + for (const requirement of requirements) { + const rulePage = parsePage(outdent` + --- + id: abc123 + name: Hello world + rule_type: atomic + description: hello world + accessibility_requirements: + ${requirement.source} + input_aspects: + - DOM Tree + acknowledgments: + authors: + - Wilco Fiers + --- + + [hello][], [w3c][] + + ## Passed Example 1 + + ${q}html + + ${q} + + [hello]: #hello + [w3c]: https://w3.org 'W3C website' + `) as RulePage; + + const taskforceMarkdown = getRuleContent( + { ...rulePage, filename: "abc123.md" }, + glossary, + + { matrix: true }, + [] + ); + + expect(taskforceMarkdown).toBe( + outdent` + --- + title: "Hello world" + permalink: /standards-guidelines/act/rules/abc123/ + ref: /standards-guidelines/act/rules/abc123/ + lang: en + github: + repository: w3c/wcag-act-rules + path: content/rules/abc123/index.md + feedbackmail: public-wcag-act@w3.org + footer: | + ${indent(getFooter(rulePage.frontmatter, false))} + proposed: false + rule_meta: + id: abc123 + name: "Hello world" + rule_type: atomic + original_file: abc123.md + description: | + hello world + last_modified: ${moment().format("D MMMM YYYY")} + --- + + [hello][], [w3c][] + + ## Accessibility Requirements Mapping + + ${requirement.expected} + + ## Input Aspects + + The following aspects are required in using this rule. + + - [DOM Tree](https://www.w3.org/TR/act-rules-aspects/#input-aspects-dom) + + ## Test Cases + + ### Passed + + #### Passed Example 1 + + Open in a new tab + + ${q}html + + ${q} + + ### Failed + + _There are no failed examples._ + + ### Inapplicable + + _There are no inapplicable examples._ + + ## Glossary + + ### Hello {#hello} + + Hello [world][] + + ### Outcome {#outcome} + + All good. + + ### World {#world} + + World of the [ACT-rules community][] + + [act-rules community]: https://act-rules.github.io + [hello]: #hello + [w3c]: https://w3.org 'W3C website' + [world]: #world + + ` + ); + } + }); }); diff --git a/src/rule-transform/rule-content/__tests__/get-requirements-map.ts b/src/rule-transform/rule-content/__tests__/get-requirements-map.ts index 632b547..08ac803 100644 --- a/src/rule-transform/rule-content/__tests__/get-requirements-map.ts +++ b/src/rule-transform/rule-content/__tests__/get-requirements-map.ts @@ -108,8 +108,8 @@ describe("getRequirementsMap", () => { frontmatter: { ...defaultMatter, accessibility_requirements: { - "aria11:state_property_processing": { - title: "ARIA 1.1, 7.6 State and Property Attribute Processing", + "aria12:state_property_processing": { + title: "ARIA 1.2, 7.6 State and Property Attribute Processing", forConformance: true, ...scRequirement, }, @@ -117,7 +117,7 @@ describe("getRequirementsMap", () => { }, }); expect(reqMap).toContain( - "ARIA 1.1, 7.6 State and Property Attribute Processing" + "ARIA 1.2, 7.6 State and Property Attribute Processing" ); expect(reqMap).toContain("Required for conformance"); expect(reqMap).toContain("WAI-ARIA requirement is not satisfied"); From ad507dd914f7d6384f79df12a5661fb6e42f4bcb Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Thu, 28 Sep 2023 10:56:27 +0200 Subject: [PATCH 3/5] Add integration tests --- src/act/__tests__/get-accessibility-requirement.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/act/__tests__/get-accessibility-requirement.ts b/src/act/__tests__/get-accessibility-requirement.ts index e79367c..df8238a 100644 --- a/src/act/__tests__/get-accessibility-requirement.ts +++ b/src/act/__tests__/get-accessibility-requirement.ts @@ -29,16 +29,16 @@ describe("getAccessibilityRequirement", () => { it("returns ARIA requirements", () => { const ariaReq = getAccessibilityRequirement({ - requirementId: "aria11:childrenArePresentational", + requirementId: "aria12:childrenArePresentational", title: "5.2.8 Presentational Children", }); expect(ariaReq).toEqual({ - conformanceLevel: "WAI-ARIA 1.1 author requirements", + conformanceLevel: "WAI-ARIA 1.2 author requirements", requirementType: "WAI-ARIA requirement", title: "5.2.8 Presentational Children", shortTitle: "5.2.8 Presentational Children", - url: "https://www.w3.org/TR/wai-aria-1.1/#childrenarepresentational", + url: "https://www.w3.org/TR/wai-aria-1.2/#childrenarepresentational", }); }); From 5115ed414cfdfea61d38e6d40ccbcd9746b6b2b7 Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Thu, 28 Sep 2023 11:20:36 +0200 Subject: [PATCH 4/5] Add comment about unused mappings --- src/act/get-accessibility-requirement.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/act/get-accessibility-requirement.ts b/src/act/get-accessibility-requirement.ts index 97a29bc..3625eac 100644 --- a/src/act/get-accessibility-requirement.ts +++ b/src/act/get-accessibility-requirement.ts @@ -15,12 +15,14 @@ const accessibilityDocs: AccessibilityDocuments = { baseURL: "https://www.w3.org/TR/wai-aria-1.2/#", requirementType: "WAI-ARIA requirement", }, + // Note: as of 28/09/2023, we have no rule mapping to DPUB ARIA "dpub-aria": { conformanceLevel: "WAI-ARIA Digital Publishing Module 1.0 author requirements", baseURL: "https://www.w3.org/TR/dpub-aria-1.0/#", requirementType: "WAI-ARIA Digital Publishing Module requirement", }, + // Note: as of 28/09/2023, we have no rule mapping to Graphics ARIA "graphics-aria": { conformanceLevel: "WAI-ARIA Graphics Module 1.0 author requirements", baseURL: "https://www.w3.org/TR/graphics-aria-1.0/#", From 546b70eaa649f604a3b0d06516683f20ea852780 Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Thu, 28 Sep 2023 11:21:00 +0200 Subject: [PATCH 5/5] Add test for all used mappings --- .../__tests__/get-rule-content.ts | 104 +++++++++++++++--- 1 file changed, 91 insertions(+), 13 deletions(-) diff --git a/src/rule-transform/__tests__/get-rule-content.ts b/src/rule-transform/__tests__/get-rule-content.ts index 38459c4..ee5029a 100644 --- a/src/rule-transform/__tests__/get-rule-content.ts +++ b/src/rule-transform/__tests__/get-rule-content.ts @@ -206,6 +206,28 @@ describe("getRuleContent", () => { // but are effectively tested as part of the previous one. it("accept all possible non-WCAG mappings", () => { const requirements = [ + { + source: `wcag-technique:ARIA5: # Using WAI-ARIA state and property attributes to expose the state of a user interface component + forConformance: false + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed`, + expected: outdent` +
    +
  • + ARIA5: Using WAI-ARIA state and property attributes to expose the state of a user interface component +
      +
    • Learn more about technique ARIA5
    • +
    • Not required for conformance to any W3C accessibility recommendation.
    • +
    • Outcome mapping:
        +
      • Any failed outcomes: technique is not satisfied
      • +
      • All passed outcomes: technique needs further testing
      • +
      • An inapplicable outcome: technique needs further testing
      • +
    • +
    +
  • +
`, + }, { source: `aria12:state_property_processing: title: ARIA 1.2, 8.6 State and Property Attribute Processing @@ -228,20 +250,76 @@ describe("getRuleContent", () => { `, - // { - // source: `wcag-technique:ARIA5: # Using WAI-ARIA state and property attributes to expose the state of a user interface component - // forConformance: false - // failed: not satisfied - // passed: further testing needed - // inapplicable: further testing needed`, - // expected: outdent``, - // }, }, - // { source: `dpub-aria:`, expected: outdent`` }, - // { source: `graphics-aria`, expected: outdent`` }, - // { source: `html-aria:`, expected: outdent`` }, - // { source: `using-aria:`, expected: outdent`` }, - // { source: `wcag-text:`, expected: outdent`` }, + { + source: `html-aria:docconformance: + title: ARIA in HTML, 4. Document conformance requirements for use of ARIA attributes in HTML + forConformance: true + failed: not satisfied + passed: satisfied + inapplicable: satisfied`, + expected: outdent` + `, + }, + { + source: `using-aria:fourth: + title: Fourth rule of ARIA use + forConformance: false + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed`, + expected: outdent` +
    +
  • + Fourth rule of ARIA use +
      +
    • Learn more about Fourth rule of ARIA use
    • +
    • Not required for conformance to any W3C accessibility recommendation.
    • +
    • Outcome mapping:
        +
      • Any failed outcomes: WAI-ARIA rule is not satisfied
      • +
      • All passed outcomes: WAI-ARIA rule needs further testing
      • +
      • An inapplicable outcome: WAI-ARIA rule needs further testing
      • +
    • +
    +
  • +
`, + }, + { + source: `wcag-text:cc5: # Non-interference due to mapping to 2.2.2 + title: WCAG Non-Interference + forConformance: true + failed: not satisfied + passed: further testing needed + inapplicable: further testing needed`, + expected: outdent` +
    +
  • + WCAG Non-Interference +
      +
    • Learn more about WCAG Non-Interference
    • +
    • Required for conformance to WCAG 2.1.
    • +
    • Outcome mapping:
        +
      • Any failed outcomes: WCAG 2 conformance requirement is not satisfied
      • +
      • All passed outcomes: WCAG 2 conformance requirement needs further testing
      • +
      • An inapplicable outcome: WCAG 2 conformance requirement needs further testing
      • +
    • +
    +
  • +
`, + }, ]; for (const requirement of requirements) {