@ngbracket/a11y-devtools 0.5.0 → 0.7.0
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/CHANGELOG.md +46 -0
- package/README.md +59 -4
- package/bin/ngbr-a11y-report.mjs +5 -0
- package/dist/attribution.d.ts +22 -0
- package/dist/attribution.js +26 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +4 -1
- package/dist/inpage.global.js +378 -8
- package/dist/keyboard/accname.d.ts +42 -0
- package/dist/keyboard/accname.js +131 -0
- package/dist/keyboard/keyboard-scan.d.ts +14 -0
- package/dist/keyboard/keyboard-scan.js +117 -0
- package/dist/keyboard/tab-sequence.d.ts +58 -0
- package/dist/keyboard/tab-sequence.js +178 -0
- package/dist/overlay.d.ts +22 -0
- package/dist/overlay.js +157 -1
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +36 -4
- package/dist/report/headless.d.ts +7 -0
- package/dist/report/headless.js +2 -2
- package/dist/runner.d.ts +6 -0
- package/dist/runner.js +1 -0
- package/dist/scan.d.ts +7 -0
- package/dist/scan.js +6 -0
- package/package.json +1 -1
|
@@ -26,6 +26,13 @@ export interface ScanPagesOptions {
|
|
|
26
26
|
* library's own code (so it blames the library component, not a demo wrapper).
|
|
27
27
|
*/
|
|
28
28
|
frameworkPrefixes?: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Also run the keyboard layer in-page — heuristic `ngbr/*` findings for
|
|
31
|
+
* keyboard-unreachable controls, click-without-keyboard handlers, and
|
|
32
|
+
* tab-order mismatches (the last needs real layout, which headless has).
|
|
33
|
+
* Default false.
|
|
34
|
+
*/
|
|
35
|
+
keyboard?: boolean;
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* Drive a real headless browser over a running Angular **dev** build and return
|
package/dist/report/headless.js
CHANGED
|
@@ -21,7 +21,7 @@ function inPageScriptPath() {
|
|
|
21
21
|
* to the component that rendered it — with no change to the target app.
|
|
22
22
|
*/
|
|
23
23
|
export async function scanPages(options) {
|
|
24
|
-
const { baseUrl, routes, tags, waitMs = 1500, labels = {}, setup, headed = false, frameworkPrefixes } = options;
|
|
24
|
+
const { baseUrl, routes, tags, waitMs = 1500, labels = {}, setup, headed = false, frameworkPrefixes, keyboard, } = options;
|
|
25
25
|
const axeOptions = tags
|
|
26
26
|
? { runOnly: { type: 'tag', values: tags } }
|
|
27
27
|
: undefined;
|
|
@@ -48,7 +48,7 @@ export async function scanPages(options) {
|
|
|
48
48
|
const findings = (await page.evaluate((args) => {
|
|
49
49
|
const w = window;
|
|
50
50
|
return w.__ngbA11yScan(args.axe, args.scan);
|
|
51
|
-
}, { axe: axeOptions, scan: { frameworkPrefixes } }));
|
|
51
|
+
}, { axe: axeOptions, scan: { frameworkPrefixes, keyboard } }));
|
|
52
52
|
pages.push({ label, url: page.url(), findings });
|
|
53
53
|
}
|
|
54
54
|
catch (err) {
|
package/dist/runner.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ export interface RunOptions {
|
|
|
20
20
|
* attribute to the immediate owner (e.g. when scanning a library's own code).
|
|
21
21
|
*/
|
|
22
22
|
frameworkPrefixes?: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Also run the keyboard layer — heuristic `ngbr/*` findings for
|
|
25
|
+
* keyboard-unreachable controls, click-without-keyboard handlers, and
|
|
26
|
+
* tab-order mismatches. Default false.
|
|
27
|
+
*/
|
|
28
|
+
keyboard?: boolean;
|
|
23
29
|
}
|
|
24
30
|
/** Scan `root`, optionally report, and return the findings. */
|
|
25
31
|
export declare function runA11yScan(root?: Element | Document, options?: RunOptions): Promise<A11yFinding[]>;
|
package/dist/runner.js
CHANGED
|
@@ -4,6 +4,7 @@ import { logFindings } from './report.js';
|
|
|
4
4
|
export async function runA11yScan(root, options = {}) {
|
|
5
5
|
const findings = await scan(root ?? document, options.axe, {
|
|
6
6
|
frameworkPrefixes: options.frameworkPrefixes,
|
|
7
|
+
keyboard: options.keyboard,
|
|
7
8
|
});
|
|
8
9
|
if (options.log !== false) {
|
|
9
10
|
logFindings(findings, options.logger);
|
package/dist/scan.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export interface ScanOptions {
|
|
|
9
9
|
* immediate owner — useful when scanning a component library's own code.
|
|
10
10
|
*/
|
|
11
11
|
frameworkPrefixes?: readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* Also run the keyboard layer (part B): heuristic, `window.ng`-driven checks
|
|
14
|
+
* axe can't do — keyboard-unreachable interactive controls, click handlers
|
|
15
|
+
* with no keyboard handler, and visual-vs-tab-order mismatches. Emitted as
|
|
16
|
+
* `ngbr/*` findings alongside the axe violations. Default false.
|
|
17
|
+
*/
|
|
18
|
+
keyboard?: boolean;
|
|
12
19
|
}
|
|
13
20
|
/** One axe violation node, enriched with the component that rendered it. */
|
|
14
21
|
export interface A11yFinding {
|
package/dist/scan.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { appComponentFromPath, DEFAULT_FRAMEWORK_PREFIXES, resolveComponentPath, resolveDirectiveNames, } from './attribution.js';
|
|
2
2
|
import { OVERLAY_EXCLUDE_SELECTOR } from './overlay.js';
|
|
3
|
+
import { scanKeyboard } from './keyboard/keyboard-scan.js';
|
|
3
4
|
// axe-core is a singleton and throws if a run starts while another is in flight.
|
|
4
5
|
// Chain runs so overlapping callers (e.g. rapid rescans) serialize safely.
|
|
5
6
|
let runChain = Promise.resolve();
|
|
@@ -46,5 +47,10 @@ async function runAxeOnce(root, options, scanOptions) {
|
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
// The keyboard layer runs over the same root, in the page, and appends its own
|
|
51
|
+
// `ngbr/*` findings so they group and report exactly like the axe ones.
|
|
52
|
+
if (scanOptions?.keyboard) {
|
|
53
|
+
findings.push(...scanKeyboard(root, { frameworkPrefixes }));
|
|
54
|
+
}
|
|
49
55
|
return findings;
|
|
50
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngbracket/a11y-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|