@ngbracket/a11y-devtools 0.2.0 → 0.2.1
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/README.md +34 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
# @ngbracket/a11y-devtools
|
|
2
2
|
|
|
3
3
|
Dev-only, in-app accessibility auditing for Angular that maps each axe violation
|
|
4
|
-
back to **the component that rendered it** —
|
|
5
|
-
(
|
|
4
|
+
back to **the component that rendered it** — so you get
|
|
5
|
+
`♿ UserCardComponent — 2 issue(s)`, not a wall of CSS selectors.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The React axe tools in this space — [`@axe-core/react`](https://www.npmjs.com/package/@axe-core/react),
|
|
8
|
+
[`axe-mode`](https://github.com/raunofreiberg/axe-mode), the
|
|
9
|
+
[TanStack Devtools a11y plugin](https://tanstack.com/devtools/latest/docs/plugins/a11y)
|
|
10
|
+
— report the DOM node (selector, HTML, rule id) and highlight it, but stop there:
|
|
11
|
+
none tie a violation to the component that rendered it. This does, through
|
|
12
|
+
Angular's **documented** dev debug API (`window.ng`) rather than private framework
|
|
13
|
+
internals.
|
|
8
14
|
|
|
9
15
|
Part of the `@ngbracket` Angular tooling family.
|
|
10
16
|
|
|
11
17
|
## Status
|
|
12
18
|
|
|
13
|
-
Ships attribution + axe scan + grouped
|
|
14
|
-
+ the
|
|
19
|
+
Ships attribution — component **and** directive-level — + axe scan + grouped
|
|
20
|
+
console reporter (with a summary line) + the dev-only provider + the visual in-app
|
|
21
|
+
overlay (severity-coloured highlights, click-to-scroll).
|
|
15
22
|
|
|
16
23
|
## How the attribution works
|
|
17
24
|
|
|
18
25
|
Angular publishes debug helpers on the `window.ng` global in dev mode.
|
|
19
26
|
`getOwningComponent(node)` returns the component whose view contains a DOM node,
|
|
20
|
-
so any axe-flagged element resolves to its owning component
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
so any axe-flagged element resolves to its owning component; `getDirectives(node)`
|
|
28
|
+
adds the directives applied to that node — including those pulled in via
|
|
29
|
+
`hostDirectives` — which are the runtime cases a static ESLint pass can't see.
|
|
30
|
+
These helpers exist **only in dev builds** — which is exactly right: the tool is
|
|
31
|
+
dev-only, and the global's absence in prod is the signal to no-op.
|
|
23
32
|
|
|
24
33
|
## Install
|
|
25
34
|
|
|
@@ -55,6 +64,20 @@ provideA11yDevtools({
|
|
|
55
64
|
});
|
|
56
65
|
```
|
|
57
66
|
|
|
67
|
+
Findings are grouped by owning component, led by a summary line, and each node's
|
|
68
|
+
directives are shown inline:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
♿ a11y-devtools: 2 issue(s) across 1 component(s)
|
|
72
|
+
♿ UserCardComponent — 2 issue(s)
|
|
73
|
+
critical · image-alt: Images must have alternative text [via TooltipDirective]
|
|
74
|
+
img
|
|
75
|
+
https://dequeuniversity.com/rules/axe/4.13/image-alt
|
|
76
|
+
serious · color-contrast: Elements must meet minimum contrast
|
|
77
|
+
button.save
|
|
78
|
+
https://dequeuniversity.com/rules/axe/4.13/color-contrast
|
|
79
|
+
```
|
|
80
|
+
|
|
58
81
|
You can also scan on demand:
|
|
59
82
|
|
|
60
83
|
```ts
|
|
@@ -87,9 +110,7 @@ npm run build # tsc -> dist/ (ESM + .d.ts)
|
|
|
87
110
|
|
|
88
111
|
## Roadmap
|
|
89
112
|
|
|
90
|
-
-
|
|
91
|
-
a static ESLint pass can't see.
|
|
92
|
-
- Per-component filtering and a violation count badge.
|
|
113
|
+
- Per-component filtering and a violation-count badge.
|
|
93
114
|
|
|
94
|
-
Done: attribution ·
|
|
95
|
-
in-app overlay · CI prod-weight guard.
|
|
115
|
+
Done: component attribution · directive / `hostDirectives` attribution · axe scan ·
|
|
116
|
+
grouped console reporter · dev-only provider · in-app overlay · CI prod-weight guard.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngbracket/a11y-devtools",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Dev-only in-app accessibility auditing for Angular that maps each axe violation back to the component that rendered it — the attribution React overlay tools can't do.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Duncan Faulkner",
|