automatica11y 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/README.md +13 -4
- package/package.json +2 -1
- package/skills/automatica11y/SKILL.md +5 -3
- package/skills/automatica11y-runner/SKILL.md +15 -10
- package/src/commands/common.js +1 -1
- package/src/data/README.md +19 -0
- package/src/data/wcag-2.2.json +7557 -0
- package/src/data/wcag-2.2.source.json +6 -0
- package/src/globals.d.ts +1 -0
- package/src/harness/bundle.js +16 -2
- package/src/harness/npm-install.js +69 -5
- package/src/plan/mapping.js +2 -1
- package/src/plan/resolve-npm.js +2 -1
- package/src/report/comparison.js +14 -4
- package/src/report/parts.js +31 -3
- package/src/run/audit-npm.js +24 -6
- package/src/run/run-plan.js +6 -1
- package/src/run/summary.js +5 -0
- package/src/schema.js +5 -2
- package/src/tiers/computed/checks.js +158 -0
- package/src/tiers/computed/color.js +40 -0
- package/src/tiers/computed/index.js +25 -0
- package/src/tiers/computed/measure-kit.js +205 -0
- package/src/tiers/interactions/archetypes.js +6 -4
- package/src/tiers/interactions/focus-indicator.js +39 -0
- package/src/tiers/interactions/helpers.js +31 -16
- package/src/tiers/interactions/index.js +3 -3
- package/src/tiers/rules/axe.js +4 -3
- package/src/wcag/index.js +83 -0
package/AGENTS.md
CHANGED
|
@@ -29,4 +29,4 @@ Both print files that live in `skills/automatica11y-runner/` in the repository a
|
|
|
29
29
|
- Heavy dependencies (Playwright, esbuild, the rule engines) load only when a command needs them. A test checks that `--version`, `doctor`, `guide`, and `--plan` never import them.
|
|
30
30
|
- Keep findings from axe-core and IBM Equal Access separate. Never add their counts together or convert one engine's scale into the other's.
|
|
31
31
|
- A gap, an error, a failed target, or a result that isn't testable is a finding. It never counts as a pass. A report says "no automated violations found" only where an engine found none, and never says "accessible."
|
|
32
|
-
- There are two skills. `skills/automatica11y/` is a tiny bootstrap that people copy. It sends an agent to `guide`. `skills/automatica11y-runner/` holds the full steps and ships with the tool. The runner names the version series it works with. The series is the major and minor version while the major version is 0 (`0.2`), and the major version alone from 1.0 on. Update the series named in `skills/automatica11y-runner/SKILL.md` (written like `0.2.x`) whenever the series of the version in `package.json` changes, for example from `0.2.x` to `0.3.0`. A change from `0.2.5` to `0.2.6` needs no update. A test fails if they disagree.
|
|
32
|
+
- There are two skills. `skills/automatica11y/` is a tiny bootstrap that people copy. It sends an agent to `guide skill`. `skills/automatica11y-runner/` holds the full steps and ships with the tool. The runner names the version series it works with. The series is the major and minor version while the major version is 0 (`0.2`), and the major version alone from 1.0 on. Update the series named in `skills/automatica11y-runner/SKILL.md` (written like `0.2.x`) whenever the series of the version in `package.json` changes, for example from `0.2.x` to `0.3.0`. A change from `0.2.5` to `0.2.6` needs no update. A test fails if they disagree.
|
package/README.md
CHANGED
|
@@ -44,10 +44,11 @@ A local `.html` file is served over `http://localhost`, never `file://`. A stati
|
|
|
44
44
|
|
|
45
45
|
## What it checks.
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Four tiers run by default. Use `--tiers` to pick fewer.
|
|
48
48
|
|
|
49
49
|
- **Rules.** axe-core and IBM Equal Access run side by side. They overlap, and each catches things the other misses. Their findings are reported separately and never added together. axe-core reports an impact (`minor` to `critical`). IBM reports its Toolkit level, a staged adoption scale where level 1 is essential, high-impact requirements. The two scales aren't comparable.
|
|
50
50
|
- **Interactions.** Keyboard and focus checks for nine archetypes: button, link, dialog, menu, tabs, combobox, form-field, accordion, and tooltip. Each check runs on a fresh page.
|
|
51
|
+
- **Computed checks.** automatica11y's own measurements from resolved styles in the browser, for the trigger of each archetype fixture: text contrast in rest, hover, keyboard focus, and pressed states (1.4.3), the contrast of the control's edge, fill, or icon (1.4.11), and the contrast and thickness of the focus indicator (1.4.11, and 2.4.13 at level AAA). A page that uses a gradient, an image, or transparency behind the control can't be reduced to one color, so that check reports `undetermined`, which is a gap and never a pass. These results are reported on their own and never added to the rule engines' counts.
|
|
51
52
|
- **Virtual screen reader.** The announcements a simulated screen reader makes, recorded as data. The output is simulated. It isn't a real screen reader, and real ones announce things differently.
|
|
52
53
|
|
|
53
54
|
Every result says what it ran, or why it didn't. A gap, a failure, or a result that can't be tested is a finding. It never counts as a pass.
|
|
@@ -59,7 +60,7 @@ Every result says what it ran, or why it didn't. A gap, a failure, or a result t
|
|
|
59
60
|
| `--wcag 2.0\|2.1\|2.2` | `2.2` | The WCAG version. |
|
|
60
61
|
| `--level A\|AA\|AAA` | `AA` | The conformance level. IBM Equal Access has no AAA rules, so it runs its AA rules and says so. |
|
|
61
62
|
| `--engine axe,ibm` | both | Which rule engines run. |
|
|
62
|
-
| `--tiers rules,interactions,vsr` | all | Which tiers run. |
|
|
63
|
+
| `--tiers rules,interactions,computed,vsr` | all | Which tiers run. |
|
|
63
64
|
| `--archetypes a,b` | all | Limit npm and Storybook targets to these archetypes. |
|
|
64
65
|
| `--lib-a11y on,off` | both | For libraries with opt-in accessibility features. See [the fixture guide](skills/automatica11y-runner/references/fixtures.md). |
|
|
65
66
|
| `--mapping <file>` | none | A mapping file for npm targets. |
|
|
@@ -111,7 +112,7 @@ npx automatica11y@latest guide fixtures # how to write the fixtures an npm pack
|
|
|
111
112
|
|
|
112
113
|
The guidance ships with the tool, so it always matches the version you run. Tell your agent to run `npx automatica11y@latest guide` and follow it, then ask for things like "How accessible is Radix Dialog?" or "Compare the accessibility of React Aria and Headless UI." The agent needs to run shell commands and read and write files. Nothing here is tied to one agent.
|
|
113
114
|
|
|
114
|
-
**Skills.** If your agent loads skills from a folder, copy [`skills/automatica11y`](skills/automatica11y) into it. That's one small file, `SKILL.md`. It advertises the tool to the agent, and sends it to `guide`. It names no version, so it doesn't go stale. The full steps are the [`automatica11y-runner`](skills/automatica11y-runner) skill, which ships in the package and is what `guide skill` prints. Copy it too if you want the steps available without the network.
|
|
115
|
+
**Skills.** If your agent loads skills from a folder, copy [`skills/automatica11y`](skills/automatica11y) into it. That's one small file, `SKILL.md`. It advertises the tool to the agent, and sends it to `guide skill`. It names no version, so it doesn't go stale. The full steps are the [`automatica11y-runner`](skills/automatica11y-runner) skill, which ships in the package and is what `guide skill` prints. Copy it too if you want the steps available without the network.
|
|
115
116
|
|
|
116
117
|
**AGENTS.md.** [`AGENTS.md`](AGENTS.md) is for agents that read it but don't load skills. It points to the same steps, and tells contributors how to run and change the code.
|
|
117
118
|
|
|
@@ -134,4 +135,12 @@ The run exits 1 when the check trips. Needs-review items never trip it.
|
|
|
134
135
|
|
|
135
136
|
## License.
|
|
136
137
|
|
|
137
|
-
MIT. See [LICENSE](LICENSE).
|
|
138
|
+
MIT. See [LICENSE](LICENSE). The WCAG data below has its own terms.
|
|
139
|
+
|
|
140
|
+
## Attribution.
|
|
141
|
+
|
|
142
|
+
automatica11y reads WCAG criterion numbers, names, levels, and versions from the W3C's published JSON, [wcag.json](https://www.w3.org/WAI/WCAG22/wcag.json). The package ships that file in `src/data/` without changes.
|
|
143
|
+
|
|
144
|
+
Source: [Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/), W3C. The JSON is used under the [terms in the W3C WCAG repository](https://github.com/w3c/wcag/blob/main/11ty/json/README.md): the source is credited with a link, and the content isn't changed. See also the [W3C Document License](https://www.w3.org/copyright/document-license/) and [W3C Intellectual Rights](https://www.w3.org/copyright/intellectual-rights/). The links that reports build to each criterion are added by automatica11y and aren't part of the W3C data.
|
|
145
|
+
|
|
146
|
+
Every report repeats this credit in its closing section. To refresh the data, run `npm run update-wcag`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "automatica11y",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Test and compare the accessibility of web pages, Storybook builds, and npm component libraries.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"test": "node --test test/*.test.js",
|
|
21
21
|
"lint": "tsc -p jsconfig.json",
|
|
22
|
+
"update-wcag": "node scripts/update-wcag.js",
|
|
22
23
|
"prepublishOnly": "npm run lint"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
@@ -13,11 +13,13 @@ automatica11y tests and compares web accessibility. This skill only gets you sta
|
|
|
13
13
|
3. Run this, read all of what it prints, and follow it:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx --yes automatica11y@latest guide
|
|
16
|
+
npx --yes automatica11y@latest guide skill
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
If the
|
|
19
|
+
If the error mentions `ETARGET` (npm says a version doesn't exist, usually because its local list is out of date), run the command once more with `--prefer-online`: `npx --yes --prefer-online automatica11y@latest guide skill`.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
If the command exits with an error or prints no usable output, including after that retry, tell the user it failed, include the error text, and stop. Don't continue with partial instructions.
|
|
22
|
+
|
|
23
|
+
After reading the steps, pass only settings they list as supported. If the user named a setting they don't list as supported, tell the user which setting is unsupported, list the supported values from the steps, and ask which to use. Don't ask again for anything they've already said.
|
|
22
24
|
|
|
23
25
|
4. If you can't run shell commands, or `npx` can't reach the npm registry, tell the user and stop. Don't guess at results.
|
|
@@ -14,6 +14,8 @@ The tool is **not** an attestation or certification tool. Automated checks cover
|
|
|
14
14
|
|
|
15
15
|
## 1. Check the version
|
|
16
16
|
|
|
17
|
+
Do sections 1 and 2 before you run an audit. A question to the user about a missing target or an unsupported setting (section 3) can come before or after them.
|
|
18
|
+
|
|
17
19
|
This skill works with automatica11y **0.3.x**. Run:
|
|
18
20
|
|
|
19
21
|
```bash
|
|
@@ -39,7 +41,7 @@ npx --yes automatica11y@latest audit <target> [options]
|
|
|
39
41
|
npx --yes automatica11y@latest compare <target> <target> [<target>...] [options]
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
Use `audit` for one target and `compare` for two or more. A target is `[label=]<spec>`. The label is optional and names the target in the report.
|
|
44
|
+
Use `audit` for one target and `compare` for two or more, even when they're different kinds, such as a live page and an npm package. The report then opens with a warning that the evidence isn't equivalent. A target is `[label=]<spec>`. The label is optional and names the target in the report.
|
|
43
45
|
|
|
44
46
|
| The user means | The spec is |
|
|
45
47
|
|---|---|
|
|
@@ -57,7 +59,7 @@ Options you can set, and nothing else:
|
|
|
57
59
|
| `--wcag 2.0\|2.1\|2.2` | `2.2` | The user names a WCAG version. |
|
|
58
60
|
| `--level A\|AA\|AAA` | `AA` | The user names a level. IBM Equal Access has no AAA rules, so it runs its AA rules and says so. |
|
|
59
61
|
| `--engine axe,ibm` | both | The user wants one rule engine. |
|
|
60
|
-
| `--tiers rules,interactions,vsr` | all
|
|
62
|
+
| `--tiers rules,interactions,computed,vsr` | all four | The user wants fewer checks. |
|
|
61
63
|
| `--archetypes a,b` | all | The user cares about some components. Choose from button, link, dialog, menu, tabs, combobox, form-field, accordion, tooltip, chart. |
|
|
62
64
|
| `--lib-a11y on,off` | both | Only for libraries with opt-in accessibility features. |
|
|
63
65
|
| `--mapping <file>` | none | You wrote or edited a mapping file. |
|
|
@@ -72,7 +74,7 @@ Use the target and the settings the user already gave, and ask only for what's m
|
|
|
72
74
|
|
|
73
75
|
Pass only the options in the table above, with the values it lists. If the user names a setting the tool doesn't have, or a value outside those lists (for example, WCAG 3.0), tell them which setting is unsupported, list the supported values, and ask which to use. Don't substitute a default or invent a value.
|
|
74
76
|
|
|
75
|
-
Show the user the exact command before you run it. If a target
|
|
77
|
+
Show the user the exact command before you run it. If you have questions (a target that could mean two things, a missing target, an unsupported setting), ask them together in one message, then go on.
|
|
76
78
|
|
|
77
79
|
Don't set the fail flags unless the user asks for gating. They change the exit code. They don't change the results.
|
|
78
80
|
|
|
@@ -82,9 +84,9 @@ A package's components can't be guessed from its name. The first run installs th
|
|
|
82
84
|
|
|
83
85
|
1. Run the audit once. Read `<out>/mapping.json` and the report's **Archetypes** table.
|
|
84
86
|
2. Treat the mapping as a guess. Check each `export` or `tag` against what the user asked about.
|
|
85
|
-
3. For each archetype marked `needs-fixture` that matters to the request, write `fixtures/<target id>/<archetype>.jsx` (`.js` for web components) in the working directory. Follow the contract and the examples below. `references/fixtures.md` has more: the mapping file, states, and library accessibility options. It should sit next to this file. If you can't open it, run `npx --yes automatica11y@latest guide fixtures` to print it. The contract here is enough for the first fixture.
|
|
87
|
+
3. Each archetype in `mapping.json` has a status. `needs-fixture` means the tool found the component but can't build it from a template. `no-match` means no export or custom element looks like that archetype. For each archetype marked `needs-fixture` that matters to the request, write `fixtures/<target id>/<archetype>.jsx` (`.js` for web components) in the working directory. Follow the contract and the examples below. `references/fixtures.md` has more: the mapping file, states, and library accessibility options. It should sit next to this file. If you can't open it, run `npx --yes automatica11y@latest guide fixtures` to print it. The contract here is enough for the first fixture.
|
|
86
88
|
4. Run the same command again. The tool finds fixtures in that folder without `--mapping`.
|
|
87
|
-
5. Don't invent fixtures for archetypes the user didn't ask about. A gap is an honest result.
|
|
89
|
+
5. Don't invent fixtures for archetypes the user didn't ask about. For a `no-match` archetype, write a fixture only if the library's documentation names a component, or a documented way, to make it. Otherwise leave it as a gap. A gap is an honest result.
|
|
88
90
|
|
|
89
91
|
**The fixture contract, in brief.**
|
|
90
92
|
|
|
@@ -138,7 +140,7 @@ Run the command. Note the exit code:
|
|
|
138
140
|
|
|
139
141
|
| Code | Meaning |
|
|
140
142
|
|---|---|
|
|
141
|
-
| 0 | The run completed. Findings don't change this unless a fail flag was set. |
|
|
143
|
+
| 0 | The run completed. Findings don't change this unless a fail flag was set. A target that failed while others ran still exits 0, and the failure is in the results. |
|
|
142
144
|
| 1 | The run completed and a fail flag tripped. |
|
|
143
145
|
| 2 | The command was wrong. Read the message, fix it, and run again. |
|
|
144
146
|
| 3 | An environment problem. Relay the fix. |
|
|
@@ -154,14 +156,16 @@ Write the narrative from `results.json`. Never write from memory, and never repe
|
|
|
154
156
|
2. For a comparison, say that every target used the same archetypes, WCAG version, level, and rules.
|
|
155
157
|
3. Open with the coverage matrix (target by archetype by tier). Then give the findings.
|
|
156
158
|
4. Keep violations, needs-review items, and passes in separate lists. Never merge them.
|
|
157
|
-
5. Break findings out by archetype and by
|
|
159
|
+
5. Break findings out by archetype. Within an archetype, order axe-core findings by impact and IBM findings by Toolkit level.
|
|
158
160
|
6. Use "no automated violations found" only for an engine that reported none for that target. For an engine that reported violations, list them as the tool reports them. Never say "accessible," "compliant," or "passes WCAG."
|
|
159
161
|
7. Don't print a single score. If someone insists, pair any number with the coverage matrix and the automated-coverage caveat.
|
|
160
162
|
8. Label virtual screen reader output **simulated**. Label library accessibility options **on** or **off** on every result that has one.
|
|
161
163
|
9. Treat a gap, a not-testable result, an error, or a failed target as a finding. It never counts as a pass.
|
|
162
164
|
10. If the comparison mixes component targets and page targets, open with a warning that the evidence isn't equivalent.
|
|
163
165
|
11. Label every rule finding with its engine. Report axe-core and IBM Equal Access separately. Never add their counts together. Impact is axe-core's own label. IBM Toolkit level is IBM's staged adoption scale (1 is essential, high-impact requirements). Don't convert one into the other.
|
|
164
|
-
12.
|
|
166
|
+
12. Report computed checks (contrast measured from resolved styles) in their own section. Give the measured ratio next to the ratio the criterion needs, and name the state or the method. Never add them to axe-core or IBM counts. Treat `undetermined` as a gap, never as a pass. When a control has visible text and a pale edge, the result is `not-applicable`, because the text identifies the control. Say that, and leave it for a person to confirm.
|
|
167
|
+
13. When you name a WCAG criterion, use the number and name exactly as `report.md` prints them, and keep its "WCAG data" credit to the W3C. Don't write criterion names or levels from memory.
|
|
168
|
+
14. End with a plain method note. Say what automated tools can't catch: whether alt text is meaningful, whether link and heading text make sense in context, cognitive load, real focus and reading order in use, and how real screen readers behave. Those need a person.
|
|
165
169
|
|
|
166
170
|
Use the structure of `report.md`. Quote selectors and rule IDs exactly as `results.json` has them.
|
|
167
171
|
|
|
@@ -173,8 +177,9 @@ Say these things plainly. Don't soften them, and don't fill in a result.
|
|
|
173
177
|
- **Not applicable.** The package has no rendering surface, such as a utility library. There's nothing to test.
|
|
174
178
|
- **Not testable.** The content is a canvas with no alternative, or sits in a closed shadow root. The rule engines can't see it, so the result is untested, not clean. The virtual screen reader also can't read open shadow roots.
|
|
175
179
|
- **Gap.** The archetype has no usable fixture or no matching export. Say what the archetype needs.
|
|
176
|
-
- **Error.** An interaction check couldn't finish. It's untested, not failed.
|
|
177
|
-
- **
|
|
180
|
+
- **Error.** An interaction or computed check couldn't finish. It's untested, not failed.
|
|
181
|
+
- **Undetermined.** A computed check found a gradient, an image, or transparency behind the control, so it can't reduce the page to one color. It's untested, not clean.
|
|
182
|
+
- **Failed target.** The target can't be reached, isn't a web page, or couldn't be built. The tool records it as failed with a reason. Tell the user which target failed, using the reason from `results.json`. Don't retry with guesses. If an npm target failed with a network or install error (for example `ETARGET`), you may run the same command once more. If it fails again, report it. If every target failed (exit code 4), stop. If others ran, report them, and list the failed target as a gap in coverage.
|
|
178
183
|
|
|
179
184
|
## 8. Stay out of setup
|
|
180
185
|
|
package/src/commands/common.js
CHANGED
|
@@ -237,7 +237,7 @@ export async function runSavedPlan(argv, io) {
|
|
|
237
237
|
const FLAGS = `Options:
|
|
238
238
|
--wcag <2.0|2.1|2.2> WCAG version. Default 2.2.
|
|
239
239
|
--level <A|AA|AAA> Conformance level. Default AA.
|
|
240
|
-
--tiers <list> rules, interactions, vsr. Default all
|
|
240
|
+
--tiers <list> rules, interactions, computed, vsr. Default all four.
|
|
241
241
|
--engine <list> axe, ibm. Default both.
|
|
242
242
|
--archetypes <list> Limit npm and Storybook targets to these archetypes.
|
|
243
243
|
--lib-a11y <list> on, off. Default both.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# WCAG data.
|
|
2
|
+
|
|
3
|
+
`wcag-2.2.json` is the W3C's published JSON serialization of WCAG 2.2, copied without changes from <https://www.w3.org/WAI/WCAG22/wcag.json>. `wcag-2.2.source.json` records where and when it was downloaded, and the SHA-256 of the file. A test fails if the file and that hash disagree.
|
|
4
|
+
|
|
5
|
+
automatica11y reads criterion numbers, names, levels, and versions from this file. It doesn't edit or extend the data. The links it builds from each criterion's `id` are added by automatica11y and aren't part of the W3C data.
|
|
6
|
+
|
|
7
|
+
## Attribution.
|
|
8
|
+
|
|
9
|
+
Source: [Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/), W3C. The JSON is published under the [terms in the W3C WCAG repository](https://github.com/w3c/wcag/blob/main/11ty/json/README.md): attribute the original source with a link, and don't change the content. See also the [W3C Document License](https://www.w3.org/copyright/document-license/) and [W3C Intellectual Rights](https://www.w3.org/copyright/intellectual-rights/).
|
|
10
|
+
|
|
11
|
+
Copyright © World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
|
|
12
|
+
|
|
13
|
+
## Updating.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run update-wcag
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The W3C publishes new versions monthly. The script downloads the file, checks that it has principles and terms, and writes it unchanged.
|