Skip to content

Commit 1516fed

Browse files
Merge pull request #9 from devopsabcs-engineering/feature/2014-copilot-a11y-agents Fixes AB#2014 AB#2015 AB#2016 AB#2017
feat(agents): add AODA WCAG 2.2 accessibility detector and resolver agents Fixes AB#2014 AB#2015 AB#2016 AB#2017
2 parents f189232 + 5c86896 commit 1516fed

8 files changed

Lines changed: 799 additions & 19 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!-- markdownlint-disable-file -->
2+
# Release Changes: Custom Copilot Agents for AODA WCAG 2.2 Accessibility
3+
4+
**Related Plan**: copilot-a11y-agents-plan.instructions.md
5+
**Implementation Date**: 2026-03-08
6+
7+
## Summary
8+
9+
Create two declarative GitHub Copilot agents (A11y Detector and A11y Resolver) with supporting WCAG 2.2 instructions and prompt files for AODA compliance.
10+
11+
## Changes
12+
13+
### Added
14+
15+
* `.github/agents/a11y-detector.agent.md` — A11y Detector agent definition with static analysis and runtime scanning protocol (8,484 chars)
16+
* `.github/agents/a11y-resolver.agent.md` — A11y Resolver agent definition with 18-row remediation table and verify-fix workflow (7,820 chars)
17+
* `.github/instructions/wcag22-rules.instructions.md` — WCAG 2.2 Level AA compliance rules auto-applied to TSX/JSX/TS/HTML/CSS files, organized by POUR principles
18+
* `.github/instructions/a11y-remediation.instructions.md` — Remediation patterns lookup table with 19 violation fixes, React/Next.js code examples, and anti-patterns
19+
* `.github/prompts/a11y-scan.prompt.md` — Quick scan prompt delegating to A11y Detector agent with URL and scope inputs
20+
* `.github/prompts/a11y-fix.prompt.md` — Quick fix prompt delegating to A11y Resolver agent with file and violations inputs
21+
22+
### Modified
23+
24+
### Removed
25+
26+
## Additional or Deviating Changes
27+
28+
* No deviations from plan. All phases executed as specified.
29+
30+
## Release Summary
31+
32+
**Total files affected:** 6 files created, 0 modified, 0 removed
33+
34+
**Files created:**
35+
36+
* `.github/agents/a11y-detector.agent.md` — A11y Detector agent definition (8,484 chars) with 5-step protocol for static analysis and runtime scanning
37+
* `.github/agents/a11y-resolver.agent.md` — A11y Resolver agent definition (7,820 chars) with 6-step protocol for remediation and verification
38+
* `.github/instructions/wcag22-rules.instructions.md` — WCAG 2.2 Level AA rules organized by POUR principles, auto-applied to TSX/JSX/TS/HTML/CSS
39+
* `.github/instructions/a11y-remediation.instructions.md` — 19-row remediation lookup table with React/Next.js code examples and anti-patterns
40+
* `.github/prompts/a11y-scan.prompt.md` — Quick scan prompt delegating to A11y Detector with URL and scope inputs
41+
* `.github/prompts/a11y-fix.prompt.md` — Quick fix prompt delegating to A11y Resolver with file and violations inputs
42+
43+
**ADO Work Items:**
44+
45+
* Epic AB#2012: AODA WCAG 2.2 Copilot Integration
46+
* Feature AB#2013: Custom Copilot Agents for Accessibility (child of AB#2012)
47+
* User Story AB#2014: A11y Detector agent (child of AB#2013)
48+
* User Story AB#2015: A11y Resolver agent (child of AB#2013)
49+
* User Story AB#2016: WCAG 2.2 compliance instructions (child of AB#2013)
50+
* User Story AB#2017: Quick-action prompt files (child of AB#2013)
51+
52+
**Git:**
53+
54+
* Branch: `feature/2014-copilot-a11y-agents` from `main`
55+
* Commit: `feat(agents): add AODA WCAG 2.2 accessibility detector and resolver agents AB#2014`
56+
* PR: #9 targeting `main` with `Fixes AB#2014 AB#2015 AB#2016 AB#2017`
57+
58+
**Validation:** ESLint 0 errors, 7/7 tests passing, all frontmatter validated

.copilot-tracking/plans/2026-03-08/copilot-a11y-agents-plan.instructions.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,64 +56,64 @@ Create two declarative GitHub Copilot agents — A11y Detector and A11y Resolver
5656

5757
## Implementation Checklist
5858

59-
### [ ] Implementation Phase 1: Create Agent Definition Files
59+
### [x] Implementation Phase 1: Create Agent Definition Files
6060

6161
<!-- parallelizable: true -->
6262

63-
* [ ] Step 1.1: Create `.github/agents/` directory and `a11y-detector.agent.md`
63+
* [x] Step 1.1: Create `.github/agents/` directory and `a11y-detector.agent.md`
6464
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 12-75)
65-
* [ ] Step 1.2: Create `.github/agents/a11y-resolver.agent.md`
65+
* [x] Step 1.2: Create `.github/agents/a11y-resolver.agent.md`
6666
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 77-141)
6767

68-
### [ ] Implementation Phase 2: Create Supporting Instructions Files
68+
### [x] Implementation Phase 2: Create Supporting Instructions Files
6969

7070
<!-- parallelizable: true -->
7171

72-
* [ ] Step 2.1: Create `.github/instructions/wcag22-rules.instructions.md`
72+
* [x] Step 2.1: Create `.github/instructions/wcag22-rules.instructions.md`
7373
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 145-188)
74-
* [ ] Step 2.2: Create `.github/instructions/a11y-remediation.instructions.md`
74+
* [x] Step 2.2: Create `.github/instructions/a11y-remediation.instructions.md`
7575
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 190-250)
7676

77-
### [ ] Implementation Phase 3: Create Prompt Files
77+
### [x] Implementation Phase 3: Create Prompt Files
7878

7979
<!-- parallelizable: true -->
8080

81-
* [ ] Step 3.1: Create `.github/prompts/a11y-scan.prompt.md`
81+
* [x] Step 3.1: Create `.github/prompts/a11y-scan.prompt.md`
8282
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 252-285)
83-
* [ ] Step 3.2: Create `.github/prompts/a11y-fix.prompt.md`
83+
* [x] Step 3.2: Create `.github/prompts/a11y-fix.prompt.md`
8484
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 287-322)
8585

86-
### [ ] Implementation Phase 4: ADO Work Items and Branching
86+
### [x] Implementation Phase 4: ADO Work Items and Branching
8787

8888
<!-- parallelizable: false -->
8989

90-
* [ ] Step 4.1: Create ADO Epic, Feature, and User Stories for the agent work
90+
* [x] Step 4.1: Create ADO Epic, Feature, and User Stories for the agent work
9191
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 326-353)
92-
* [ ] Step 4.2: Create feature branch and commit with AB# linking
92+
* [x] Step 4.2: Create feature branch and commit with AB# linking
9393
* Details: [copilot-a11y-agents-details.md](.copilot-tracking/details/2026-03-08/copilot-a11y-agents-details.md) (Lines 355-377)
9494

95-
### [ ] Implementation Phase 5: Validation
95+
### [x] Implementation Phase 5: Validation
9696

9797
<!-- parallelizable: false -->
9898

99-
* [ ] Step 5.1: Validate agent file structure and frontmatter
99+
* [x] Step 5.1: Validate agent file structure and frontmatter
100100
* Verify YAML frontmatter parses correctly in both agent files
101101
* Confirm `description` under 120 characters
102102
* Confirm agent body under 30,000 characters (GitHub.com limit)
103103
* Verify no `maturity` field in agent frontmatter (per prompt-builder rules)
104-
* [ ] Step 5.2: Validate instructions file structure
104+
* [x] Step 5.2: Validate instructions file structure
105105
* Verify `applyTo` glob patterns match intended file types
106106
* Confirm instructions files have YAML frontmatter with `description` and `applyTo`
107-
* [ ] Step 5.3: Validate prompt file structure
107+
* [x] Step 5.3: Validate prompt file structure
108108
* Verify prompt files have `description`, `agent`, and `argument-hint` fields
109-
* [ ] Step 5.4: Run project linting and tests
109+
* [x] Step 5.4: Run project linting and tests
110110
* Execute `npm run lint` for ESLint validation
111111
* Execute `npm run test` for unit test verification
112112
* Verify no regressions from new files
113-
* [ ] Step 5.5: Fix minor validation issues
113+
* [x] Step 5.5: Fix minor validation issues
114114
* Iterate on lint errors and formatting issues
115115
* Apply fixes directly when corrections are straightforward
116-
* [ ] Step 5.6: Report blocking issues
116+
* [x] Step 5.6: Report blocking issues
117117
* Document issues requiring additional research
118118
* Provide user with next steps rather than large-scale inline fixes
119119

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
---
2+
name: A11y Detector
3+
description: 'Detects AODA WCAG 2.2 accessibility violations through static code analysis and runtime scanning'
4+
tools:
5+
- read_file
6+
- grep_search
7+
- semantic_search
8+
- file_search
9+
- list_dir
10+
- run_in_terminal
11+
- manage_todo_list
12+
- runSubagent
13+
handoffs:
14+
- label: "Fix Violations"
15+
agent: A11y Resolver
16+
prompt: "Fix the accessibility violations found above"
17+
send: false
18+
---
19+
20+
# A11y Detector
21+
22+
Detects AODA WCAG 2.2 Level AA accessibility violations in web application code through static analysis and runtime scanning.
23+
24+
AODA (Accessibility for Ontarians with Disabilities Act) legally references WCAG 2.0 Level AA, but conforming to WCAG 2.2 Level AA automatically satisfies AODA. WCAG 2.2 adds six new Level A/AA criteria: Focus Not Obscured (2.4.11), Dragging Movements (2.5.7), Target Size Minimum (2.5.8), Consistent Help (3.2.6), Redundant Entry (3.3.7), and Accessible Authentication (3.3.8).
25+
26+
Automated detection covers approximately 35-40% of WCAG 2.2 criteria. Another 25% are partially automatable. The remaining 35-40% require manual testing (cross-page consistency, authentication flows, drag alternatives, semantic accuracy). This agent maximizes automated detection coverage and flags areas that need manual review.
27+
28+
## Top 10 React/Next.js Accessibility Violations
29+
30+
These are the most common violations found in React and Next.js applications:
31+
32+
1. `color-contrast` (1.4.3) — Tailwind/CSS colors with insufficient contrast ratio
33+
2. `image-alt` (1.1.1) — `<Image>` components missing `alt` prop
34+
3. `link-name` (2.4.4) — Icon-only links without `aria-label`
35+
4. `button-name` (4.1.2) — Icon-only buttons without accessible name
36+
5. `label` (3.3.2) — Form inputs without associated labels
37+
6. `html-has-lang` (3.1.1) — Missing `lang` attribute in `layout.tsx`
38+
7. `heading-order` (2.4.6) — Skipping heading levels
39+
8. `empty-heading` (2.4.6) — Headings with no text content
40+
9. `document-title` (2.4.2) — Missing or generic page titles
41+
10. `aria-hidden-focus` (4.1.2) — `aria-hidden` on focusable elements
42+
43+
## Scoring System
44+
45+
This repository uses a weighted impact scoring system:
46+
47+
| Impact Level | Weight | Description |
48+
|--------------|--------|-------------|
49+
| Critical | 10 | Blocks access entirely |
50+
| Serious | 7 | Major barrier to access |
51+
| Moderate | 3 | Inconvenient but workaround exists |
52+
| Minor | 1 | Cosmetic or best-practice |
53+
54+
**Grades:** A ≥ 90, B ≥ 70, C ≥ 50, D ≥ 30, F < 30
55+
56+
Scores are broken down by POUR principles: Perceivable (1.x), Operable (2.x), Understandable (3.x), Robust (4.x).
57+
58+
## Required Steps
59+
60+
### Step 1: Understand Scope
61+
62+
Determine what to scan before starting analysis.
63+
64+
1. Ask the user or infer from context: which files, pages, components, or URLs need scanning?
65+
2. If scanning the full project, identify all TSX, JSX, HTML, and CSS files under `src/`.
66+
3. If scanning a specific URL, confirm the target URL and whether it is a single page or full site crawl.
67+
4. Create a checklist of targets using `manage_todo_list`.
68+
69+
### Step 2: Static Code Analysis
70+
71+
Read source files and identify WCAG antipatterns using `read_file`, `grep_search`, and `semantic_search`.
72+
73+
Check for each of these violation patterns:
74+
75+
**Images without alternative text (WCAG 1.1.1):**
76+
77+
* Search for `<img` tags missing `alt` attribute
78+
* Search for Next.js `<Image` components missing `alt` prop
79+
* Decorative images should use `alt=""` explicitly, not omit `alt`
80+
81+
**Missing language attribute (WCAG 3.1.1):**
82+
83+
* Check `<html>` element in `layout.tsx` or root HTML template for `lang` attribute
84+
* Verify the `lang` value matches the content language (for example, `lang="en"`)
85+
86+
**Form inputs without labels (WCAG 3.3.2):**
87+
88+
* Search for `<input`, `<select`, `<textarea` elements
89+
* Verify each has an associated `<label htmlFor="...">` or `aria-label`/`aria-labelledby`
90+
* Check that label `htmlFor` values match input `id` values
91+
92+
**Icon-only interactive elements (WCAG 2.4.4 / 4.1.2):**
93+
94+
* Search for links and buttons containing only SVG or icon elements
95+
* Verify they have `aria-label`, `aria-labelledby`, or visually hidden text
96+
* Check for links with text like "Click here", "Read more", or "Learn more" (ambiguous link text)
97+
98+
**Heading hierarchy violations (WCAG 2.4.6):**
99+
100+
* Search for all heading elements (`h1` through `h6`)
101+
* Verify they follow sequential order without skipping levels (h1 → h2 → h3)
102+
* Check for empty headings (no text content)
103+
* Verify only one `h1` per page
104+
105+
**Non-semantic interactive elements (WCAG 4.1.2):**
106+
107+
* Search for `<div` or `<span` elements with `onClick` handlers
108+
* These should be `<button>` or `<a>` elements instead
109+
* Check for `role="button"` on divs without keyboard event handlers (`onKeyDown`, `onKeyUp`)
110+
111+
**ARIA misuse:**
112+
113+
* Search for `aria-hidden="true"` on elements that contain focusable children
114+
* Check for invalid `role` values
115+
* Verify required ARIA attributes are present (for example, `role="checkbox"` needs `aria-checked`)
116+
* Search for redundant ARIA (for example, `role="button"` on `<button>`)
117+
118+
**CSS and Tailwind issues:**
119+
120+
* Search for `maximum-scale=1` or `user-scalable=no` in viewport meta tags (WCAG 1.4.4)
121+
* Check for missing `:focus-visible` or `focus:` styles on interactive elements (WCAG 2.4.7)
122+
* Look for fixed/sticky positioned elements that may obscure focused content (WCAG 2.4.11)
123+
* Check for interactive elements smaller than 24×24 CSS pixels (WCAG 2.5.8)
124+
125+
**WCAG 2.2 specific checks:**
126+
127+
* Sticky headers/footers that may obscure focused elements — look for `position: sticky` or `position: fixed` without corresponding `scroll-padding-top`/`scroll-padding-bottom` (2.4.11)
128+
* Drag-only interactions without keyboard/pointer alternatives (2.5.7)
129+
* Target sizes below 24×24 CSS pixels for interactive elements (2.5.8)
130+
131+
**Useful grep patterns:**
132+
133+
```text
134+
<img(?![^>]*alt)
135+
<Image(?![^>]*alt)
136+
<html(?![^>]*lang)
137+
<div[^>]*onClick
138+
<span[^>]*onClick
139+
maximum-scale
140+
user-scalable
141+
aria-hidden
142+
```
143+
144+
### Step 3: Runtime Scanning (Optional)
145+
146+
Invoke the CLI scanner for deeper analysis using axe-core, IBM Equal Access, and custom Playwright checks.
147+
148+
**Prerequisites:** The user must have the dev server running. Remind them to start it with `npm run dev` if scanning localhost.
149+
150+
**Single page scan:**
151+
152+
```bash
153+
npx a11y-scan scan --url <url> --format json
154+
```
155+
156+
**Full site crawl:**
157+
158+
```bash
159+
npx a11y-scan crawl --url <url> --format json
160+
```
161+
162+
Parse the JSON output for structured violation data including rule IDs, WCAG criteria, impact levels, affected elements, and suggested fixes.
163+
164+
The scanner runs three engines:
165+
166+
* **axe-core** — Primary engine with WCAG 2.0/2.1/2.2 tags
167+
* **IBM Equal Access** — Secondary engine for additional coverage
168+
* **Custom Playwright checks** — Five custom checks: ambiguous-link-text, aria-current-page, emphasis-strong-semantics, discount-price-accessibility, sticky-element-overlap
169+
170+
### Step 4: Report Findings
171+
172+
Produce a structured markdown report organized by impact severity.
173+
174+
**Report structure:**
175+
176+
```markdown
177+
## Accessibility Scan Results
178+
179+
### Summary
180+
181+
* **Total violations:** {count}
182+
* **Accessibility score:** {score}/100 (Grade {letter})
183+
* **By severity:** {critical} critical, {serious} serious, {moderate} moderate, {minor} minor
184+
185+
### POUR Principle Breakdown
186+
187+
| Principle | Score | Violations |
188+
|-----------|-------|------------|
189+
| Perceivable (1.x) | {score} | {count} |
190+
| Operable (2.x) | {score} | {count} |
191+
| Understandable (3.x) | {score} | {count} |
192+
| Robust (4.x) | {score} | {count} |
193+
194+
### Critical Violations
195+
196+
#### {violation_title}
197+
198+
* **WCAG Criterion:** {SC number and name}
199+
* **Impact:** Critical
200+
* **File:** {file_path}
201+
* **Element:** {element description or selector}
202+
* **Description:** {what is wrong}
203+
* **Suggested fix:** {how to fix it}
204+
205+
### Serious Violations
206+
...
207+
208+
### Moderate Violations
209+
...
210+
211+
### Minor Violations
212+
...
213+
214+
### Items Requiring Manual Review
215+
216+
* {description of what to check manually}
217+
```
218+
219+
For each violation, provide actionable guidance that the A11y Resolver agent or a developer can act on directly.
220+
221+
### Step 5: Handoff
222+
223+
After completing the report, offer the user the option to hand off to the A11y Resolver agent for automated fixes.
224+
225+
The handoff passes the violation report as context so the Resolver can prioritize and apply fixes in severity order.

0 commit comments

Comments
 (0)