@a11y-pulse/skip-link-audit 0.1.0 → 0.1.2
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/LICENSE.md +1 -1
- package/README.md +13 -2
- package/dist/adaptor.d.ts +3 -4
- package/dist/audit.d.ts +3 -3
- package/dist/browser-scripts.d.ts +12 -15
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -51,6 +51,17 @@ await browser.close();
|
|
|
51
51
|
|
|
52
52
|
See [`examples/puppeteer`](./examples/puppeteer) for a complete, runnable example.
|
|
53
53
|
|
|
54
|
+
## Browser support
|
|
55
|
+
|
|
56
|
+
| Adaptor | Browser | Supported |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| Puppeteer | Chrome | Yes |
|
|
59
|
+
| Playwright | Chromium | Yes |
|
|
60
|
+
| Playwright | WebKit | **No.** WebKit does not move focus to links when Tab is pressed, and a skip link is a link, so the audit finds nothing. |
|
|
61
|
+
| Playwright | Firefox | Yes |
|
|
62
|
+
|
|
63
|
+
Verified by this repo's integration suites, which run every audit against each of these engines. Unsupported and partial cases are skipped there with the reason printed alongside them.
|
|
64
|
+
|
|
54
65
|
## Options
|
|
55
66
|
|
|
56
67
|
The following options can be passed to `runSkipLinkAudit` as `SkipLinkOptions`:
|
|
@@ -97,7 +108,7 @@ Activation uses a real Enter keypress rather than a synthetic click, so the keyb
|
|
|
97
108
|
|
|
98
109
|
The audit itself is framework-agnostic: it drives a page through an **adaptor**, a small interface of primitives (evaluate JS in the page, press Tab, press Enter) that the audit calls without knowing which browser automation library is behind it.
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
[`@a11y-pulse/browser-adaptor`](../browser-adaptor) ships two implementations, `PuppeteerAdaptor` and `PlaywrightAdaptor`. Other environments (Selenium, WebDriver) can be supported by implementing the same interface, exported as `SkipLinkAuditAdaptor` (aliased as `BrowserAdaptor` from the package root).
|
|
101
112
|
|
|
102
113
|
### `SkipLinkAuditAdaptor` / `BrowserAdaptor`
|
|
103
114
|
|
|
@@ -123,7 +134,7 @@ class MyFrameworkAdaptor implements SkipLinkAuditAdaptor {
|
|
|
123
134
|
}
|
|
124
135
|
```
|
|
125
136
|
|
|
126
|
-
Use [`src/adaptors/puppeteer.ts`](
|
|
137
|
+
Use [`@a11y-pulse/browser-adaptor`'s `src/adaptors/puppeteer.ts`](../browser-adaptor/src/adaptors/puppeteer.ts) as a reference implementation. It is a small, self-contained example of every method the audit needs.
|
|
127
138
|
|
|
128
139
|
## Limitations
|
|
129
140
|
|
package/dist/adaptor.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type ElementRef = unknown;
|
|
5
5
|
/**
|
|
6
|
-
* A framework-specific adaptor that provides the primitives needed by the audit. An adaptor wraps
|
|
7
|
-
*
|
|
6
|
+
* A framework-specific adaptor that provides the primitives needed by the audit. An adaptor wraps a
|
|
7
|
+
* single page in a web browser.
|
|
8
8
|
*/
|
|
9
9
|
export interface SkipLinkAuditAdaptor {
|
|
10
10
|
/**
|
|
@@ -29,8 +29,7 @@ export interface SkipLinkAuditAdaptor {
|
|
|
29
29
|
pressEnter(): Promise<void>;
|
|
30
30
|
/**
|
|
31
31
|
* Ensure the page reports focus for its lifetime. In particular, `document.hasFocus()` must
|
|
32
|
-
* function correctly and :focus styles must be applied, even when the page is not the
|
|
33
|
-
* foreground.
|
|
32
|
+
* function correctly and :focus styles must be applied, even when the page is not the foreground.
|
|
34
33
|
*
|
|
35
34
|
* This function must not throw.
|
|
36
35
|
*/
|
package/dist/audit.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ export type SkipLinkProbe = {
|
|
|
33
33
|
disposeRef(ref: ElementRef): Promise<void>;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* Tab through the first few stops looking for skip-link-like fragment anchors,
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* Tab through the first few stops looking for skip-link-like fragment anchors, then activate each
|
|
37
|
+
* candidate and check that keyboard focus moves. Enables focus reporting up front, then drives the
|
|
38
|
+
* loop.
|
|
39
39
|
*/
|
|
40
40
|
export declare function runSkipLinkAudit(adaptor: SkipLinkAuditAdaptor, options?: SkipLinkOptions): Promise<SkipLinkResult>;
|
|
41
41
|
/** The engine-neutral two-phase loop. Exported for unit testing with a fake probe. */
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* IMPORTANT: Functions in this file that are serialized and injected into the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* duplicated inside each injected function.
|
|
2
|
+
* IMPORTANT: Functions in this file that are serialized and injected into the audited page must not
|
|
3
|
+
* reference any symbols outside their own scope. Common logic (fragment parsing, target resolution,
|
|
4
|
+
* shadow-root descent) is therefore duplicated inside each injected function.
|
|
6
5
|
*/
|
|
7
6
|
/**
|
|
8
|
-
* Return the in-page fragment for a skip-link-like href, or null if the href is
|
|
9
|
-
*
|
|
10
|
-
* element target).
|
|
7
|
+
* Return the in-page fragment for a skip-link-like href, or null if the href is not a same-document
|
|
8
|
+
* hash (including the bare `#` and `#top`, which have no element target).
|
|
11
9
|
*/
|
|
12
10
|
export declare function parseInPageFragment(href: string | null): string | null;
|
|
13
11
|
/**
|
|
14
|
-
* Resolve a fragment to an element, preferring `id` then a matching `name`.
|
|
15
|
-
*
|
|
12
|
+
* Resolve a fragment to an element, preferring `id` then a matching `name`. Serialized and run in
|
|
13
|
+
* the page; must stay self-contained.
|
|
16
14
|
*/
|
|
17
15
|
export declare function resolveFragmentTargetScript(fragment: string): Element | null;
|
|
18
16
|
export type SkipLinkActiveElementBase = {
|
|
19
17
|
isBody: boolean;
|
|
20
18
|
html: string;
|
|
21
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* In-page fragment such as "#main", or null when the focused node is not a skip-link candidate.
|
|
21
|
+
*/
|
|
22
22
|
fragment: string | null;
|
|
23
23
|
targetResolves: boolean;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Read the currently focused element (descending open shadow roots) and report
|
|
27
|
-
*
|
|
26
|
+
* Read the currently focused element (descending open shadow roots) and report whether it is a
|
|
27
|
+
* skip-link-like in-page fragment anchor.
|
|
28
28
|
*/
|
|
29
29
|
export declare function probeActiveElementScript(): SkipLinkActiveElementBase;
|
|
30
30
|
/**
|
|
@@ -35,7 +35,4 @@ export declare function activeElementHandleScript(): Element | null;
|
|
|
35
35
|
* Whether document.activeElement is the fragment target or inside it.
|
|
36
36
|
*/
|
|
37
37
|
export declare function isFocusInsideTargetScript(fragment: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Focus an element.
|
|
40
|
-
*/
|
|
41
38
|
export declare function focusScript(el: Element | null): void;
|
package/dist/index.js
CHANGED
|
@@ -114,11 +114,7 @@ async function runSkipLinkLoop(probe, options) {
|
|
|
114
114
|
}
|
|
115
115
|
await probe.focusHandle(found.handle);
|
|
116
116
|
await probe.pressEnter();
|
|
117
|
-
let passed2 = await pollFocusInsideTarget(
|
|
118
|
-
probe,
|
|
119
|
-
found.fragment,
|
|
120
|
-
options.activationPollMs
|
|
121
|
-
);
|
|
117
|
+
let passed2 = await pollFocusInsideTarget(probe, found.fragment, options.activationPollMs);
|
|
122
118
|
if (!passed2) {
|
|
123
119
|
await probe.pressTab();
|
|
124
120
|
passed2 = await probe.isFocusInsideTarget(found.fragment);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/audit.ts","../src/browser-scripts.ts"],"sourcesContent":["import { getSelector, truncateHtml } from \"@a11y-pulse/browser-adaptor/dom\";\nimport type { ElementRef, SkipLinkAuditAdaptor } from \"./adaptor\";\nimport {\n\tactiveElementHandleScript,\n\tfocusScript,\n\tisFocusInsideTargetScript,\n\tprobeActiveElementScript,\n} from \"./browser-scripts\";\nimport type { SkipLinkElementResult, SkipLinkResult } from \"./result\";\n\nexport const DEFAULT_CANDIDATE_LIMIT = 3;\nexport const DEFAULT_ACTIVATION_POLL_MS = 250;\n\nexport type SkipLinkOptions = {\n\t/** Max tab stops to scan for skip-link candidates. Defaults to 3. */\n\tcandidateLimit?: number;\n};\n\nexport type ResolvedSkipLinkOptions = {\n\tcandidateLimit: number;\n\tactivationPollMs: number;\n};\n\nexport type SkipLinkCandidate = {\n\tselector: string;\n\thtml: string;\n\tfragment: string;\n\ttargetResolves: boolean;\n\thandle: ElementRef;\n};\n\nexport type TabStopProbe = {\n\tisBody: boolean;\n\t/** Unique identity of the focused element, used to detect a focus cycle. */\n\tidentity: string;\n\tcandidate: SkipLinkCandidate | null;\n};\n\n/** The browser-coupled seams the loop drives. Mocked in unit tests. */\nexport type SkipLinkProbe = {\n\tpressTab(): Promise<void>;\n\tpressEnter(): Promise<void>;\n\tprobeTabStop(): Promise<TabStopProbe>;\n\tfocusHandle(ref: ElementRef): Promise<void>;\n\tisFocusInsideTarget(fragment: string): Promise<boolean>;\n\tdisposeRef(ref: ElementRef): Promise<void>;\n};\n\nfunction resolveOptions(options: SkipLinkOptions): ResolvedSkipLinkOptions {\n\treturn {\n\t\tcandidateLimit: options.candidateLimit ?? DEFAULT_CANDIDATE_LIMIT,\n\t\tactivationPollMs: DEFAULT_ACTIVATION_POLL_MS,\n\t};\n}\n\n/**\n * Tab through the first few stops looking for skip-link-like fragment anchors,\n * then activate each candidate and check that keyboard focus moves. Enables\n * focus reporting up front, then drives the loop.\n */\nexport async function runSkipLinkAudit(\n\tadaptor: SkipLinkAuditAdaptor,\n\toptions: SkipLinkOptions = {},\n): Promise<SkipLinkResult> {\n\tawait adaptor.ensureFocusReporting();\n\n\treturn runSkipLinkLoop(createAdaptorProbe(adaptor), resolveOptions(options));\n}\n\n/** The engine-neutral two-phase loop. Exported for unit testing with a fake probe. */\nexport async function runSkipLinkLoop(\n\tprobe: SkipLinkProbe,\n\toptions: ResolvedSkipLinkOptions,\n): Promise<SkipLinkResult> {\n\tconst collected: Array<SkipLinkCandidate & { tabIndex: number }> = [];\n\tconst seen = new Set<string>();\n\n\tfor (let i = 0; i < options.candidateLimit; i++) {\n\t\tawait probe.pressTab();\n\n\t\tconst tabStop = await probe.probeTabStop();\n\n\t\tif (tabStop.isBody || seen.has(tabStop.identity)) {\n\t\t\tbreak;\n\t\t}\n\n\t\tseen.add(tabStop.identity);\n\n\t\tif (tabStop.candidate) {\n\t\t\tcollected.push({ ...tabStop.candidate, tabIndex: i + 1 });\n\t\t}\n\t}\n\n\tconst skipLinks: SkipLinkElementResult[] = [];\n\n\tfor (const found of collected) {\n\t\ttry {\n\t\t\tif (!found.targetResolves) {\n\t\t\t\tskipLinks.push({\n\t\t\t\t\tselector: found.selector,\n\t\t\t\t\thtml: found.html,\n\t\t\t\t\tfragment: found.fragment,\n\t\t\t\t\ttabIndex: found.tabIndex,\n\t\t\t\t\tpassed: false,\n\t\t\t\t\tfailureReason: \"target-missing\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tawait probe.focusHandle(found.handle);\n\t\t\tawait probe.pressEnter();\n\n\t\t\tlet passed = await pollFocusInsideTarget(\n\t\t\t\tprobe,\n\t\t\t\tfound.fragment,\n\t\t\t\toptions.activationPollMs,\n\t\t\t);\n\n\t\t\tif (!passed) {\n\t\t\t\tawait probe.pressTab();\n\t\t\t\tpassed = await probe.isFocusInsideTarget(found.fragment);\n\t\t\t}\n\n\t\t\tskipLinks.push({\n\t\t\t\tselector: found.selector,\n\t\t\t\thtml: found.html,\n\t\t\t\tfragment: found.fragment,\n\t\t\t\ttabIndex: found.tabIndex,\n\t\t\t\tpassed,\n\t\t\t\tfailureReason: passed ? null : \"activation-no-effect\",\n\t\t\t});\n\t\t} finally {\n\t\t\tawait probe.disposeRef(found.handle);\n\t\t}\n\t}\n\n\tconst passed = skipLinks.filter((link) => link.passed).length;\n\n\treturn {\n\t\tskipLinks,\n\t\tsummary: {\n\t\t\tfound: skipLinks.length,\n\t\t\tpassed,\n\t\t\tfailed: skipLinks.length - passed,\n\t\t},\n\t};\n}\n\nasync function pollFocusInsideTarget(\n\tprobe: SkipLinkProbe,\n\tfragment: string,\n\tpollMs: number,\n): Promise<boolean> {\n\tif (await probe.isFocusInsideTarget(fragment)) {\n\t\treturn true;\n\t}\n\n\tif (pollMs <= 0) {\n\t\treturn false;\n\t}\n\n\tconst deadline = Date.now() + pollMs;\n\n\twhile (Date.now() < deadline) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 16));\n\n\t\tif (await probe.isFocusInsideTarget(fragment)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction createAdaptorProbe(adaptor: SkipLinkAuditAdaptor): SkipLinkProbe {\n\treturn {\n\t\tpressTab() {\n\t\t\treturn adaptor.pressTab();\n\t\t},\n\n\t\tpressEnter() {\n\t\t\treturn adaptor.pressEnter();\n\t\t},\n\n\t\tasync probeTabStop() {\n\t\t\tconst base = await adaptor.evaluate(probeActiveElementScript);\n\n\t\t\tif (base.isBody) {\n\t\t\t\treturn { isBody: true, identity: \"body\", candidate: null };\n\t\t\t}\n\n\t\t\tconst handle = await adaptor.evaluateHandle(activeElementHandleScript);\n\t\t\tconst selector = await adaptor.evaluate(getSelector, handle);\n\t\t\tconst html = truncateHtml(base.html);\n\n\t\t\tif (base.fragment) {\n\t\t\t\treturn {\n\t\t\t\t\tisBody: false,\n\t\t\t\t\tidentity: selector,\n\t\t\t\t\tcandidate: {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\thtml,\n\t\t\t\t\t\tfragment: base.fragment,\n\t\t\t\t\t\ttargetResolves: base.targetResolves,\n\t\t\t\t\t\thandle,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tawait adaptor.disposeRef(handle);\n\n\t\t\treturn { isBody: false, identity: selector, candidate: null };\n\t\t},\n\n\t\tfocusHandle(ref) {\n\t\t\treturn adaptor.evaluate(focusScript, ref);\n\t\t},\n\n\t\tisFocusInsideTarget(fragment) {\n\t\t\treturn adaptor.evaluate(isFocusInsideTargetScript, fragment);\n\t\t},\n\n\t\tdisposeRef(ref) {\n\t\t\treturn adaptor.disposeRef(ref);\n\t\t},\n\t};\n}\n","/**\n * IMPORTANT: Functions in this file that are serialized and injected into the\n * audited page must not reference any symbols outside their own scope. Common\n * logic (fragment parsing, target resolution, shadow-root descent) is therefore\n * duplicated inside each injected function.\n */\n\n/**\n * Return the in-page fragment for a skip-link-like href, or null if the href is\n * not a same-document hash (including the bare `#` and `#top`, which have no\n * element target).\n */\nexport function parseInPageFragment(href: string | null): string | null {\n\tif (href === null || href === \"\") {\n\t\treturn null;\n\t}\n\n\tif (!href.startsWith(\"#\")) {\n\t\treturn null;\n\t}\n\n\tif (href === \"#\" || href === \"#top\") {\n\t\treturn null;\n\t}\n\n\t// Hash-router and hashbang paths are not element ids.\n\tif (href.startsWith(\"#/\") || href.startsWith(\"#!/\")) {\n\t\treturn null;\n\t}\n\n\treturn href;\n}\n\n/**\n * Resolve a fragment to an element, preferring `id` then a matching `name`.\n * Serialized and run in the page; must stay self-contained.\n */\nexport function resolveFragmentTargetScript(fragment: string): Element | null {\n\tconst raw = fragment.startsWith(\"#\") ? fragment.slice(1) : fragment;\n\tlet decoded = raw;\n\n\ttry {\n\t\tdecoded = decodeURIComponent(raw);\n\t} catch {\n\t\t// Keep the raw id when it is not valid percent-encoding.\n\t}\n\n\treturn (\n\t\tdocument.getElementById(decoded) ??\n\t\tdocument.getElementsByName(decoded)[0] ??\n\t\tnull\n\t);\n}\n\nexport type SkipLinkActiveElementBase = {\n\tisBody: boolean;\n\thtml: string;\n\t/** In-page fragment such as \"#main\", or null when the focused node is not a skip-link candidate. */\n\tfragment: string | null;\n\ttargetResolves: boolean;\n};\n\n/**\n * Read the currently focused element (descending open shadow roots) and report\n * whether it is a skip-link-like in-page fragment anchor.\n */\nexport function probeActiveElementScript(): SkipLinkActiveElementBase {\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\tif (!el || el === document.body) {\n\t\treturn {\n\t\t\tisBody: true,\n\t\t\thtml: \"\",\n\t\t\tfragment: null,\n\t\t\ttargetResolves: false,\n\t\t};\n\t}\n\n\tconst openingTag = (el.cloneNode(false) as Element).outerHTML;\n\tconst href =\n\t\tel.tagName === \"A\" ? (el as HTMLAnchorElement).getAttribute(\"href\") : null;\n\n\tlet fragment: string | null = null;\n\n\tif (\n\t\thref?.startsWith(\"#\") &&\n\t\thref !== \"#\" &&\n\t\thref !== \"#top\" &&\n\t\t!href.startsWith(\"#/\") &&\n\t\t!href.startsWith(\"#!/\")\n\t) {\n\t\tfragment = href;\n\t}\n\n\tlet targetResolves = false;\n\n\tif (fragment) {\n\t\tconst raw = fragment.slice(1);\n\t\tlet decoded = raw;\n\n\t\ttry {\n\t\t\tdecoded = decodeURIComponent(raw);\n\t\t} catch {\n\t\t\t// Keep the raw id when it is not valid percent-encoding.\n\t\t}\n\n\t\ttargetResolves = Boolean(\n\t\t\tdocument.getElementById(decoded) ??\n\t\t\t\tdocument.getElementsByName(decoded)[0],\n\t\t);\n\t}\n\n\treturn {\n\t\tisBody: false,\n\t\thtml: openingTag,\n\t\tfragment,\n\t\ttargetResolves,\n\t};\n}\n\n/**\n * Return the focused element, descending open shadow roots.\n */\nexport function activeElementHandleScript(): Element | null {\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\treturn el;\n}\n\n/**\n * Whether document.activeElement is the fragment target or inside it.\n */\nexport function isFocusInsideTargetScript(fragment: string): boolean {\n\tconst raw = fragment.startsWith(\"#\") ? fragment.slice(1) : fragment;\n\tlet decoded = raw;\n\n\ttry {\n\t\tdecoded = decodeURIComponent(raw);\n\t} catch {\n\t\t// Keep the raw id when it is not valid percent-encoding.\n\t}\n\n\tconst target =\n\t\tdocument.getElementById(decoded) ??\n\t\tdocument.getElementsByName(decoded)[0] ??\n\t\tnull;\n\n\tif (!target) {\n\t\treturn false;\n\t}\n\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\tif (!el) {\n\t\treturn false;\n\t}\n\n\treturn el === target || target.contains(el);\n}\n\n/**\n * Focus an element.\n */\nexport function focusScript(el: Element | null): void {\n\t(el as HTMLElement | null)?.focus();\n}\n"],"mappings":";AAAA,SAAS,aAAa,oBAAoB;;;ACkEnC,SAAS,2BAAsD;AACrE,MAAI,KAAK,SAAS;AAElB,SAAO,IAAI,YAAY,eAAe;AACrC,SAAK,GAAG,WAAW;AAAA,EACpB;AAEA,MAAI,CAAC,MAAM,OAAO,SAAS,MAAM;AAChC,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,MACV,gBAAgB;AAAA,IACjB;AAAA,EACD;AAEA,QAAM,aAAc,GAAG,UAAU,KAAK,EAAc;AACpD,QAAM,OACL,GAAG,YAAY,MAAO,GAAyB,aAAa,MAAM,IAAI;AAEvE,MAAI,WAA0B;AAE9B,MACC,MAAM,WAAW,GAAG,KACpB,SAAS,OACT,SAAS,UACT,CAAC,KAAK,WAAW,IAAI,KACrB,CAAC,KAAK,WAAW,KAAK,GACrB;AACD,eAAW;AAAA,EACZ;AAEA,MAAI,iBAAiB;AAErB,MAAI,UAAU;AACb,UAAM,MAAM,SAAS,MAAM,CAAC;AAC5B,QAAI,UAAU;AAEd,QAAI;AACH,gBAAU,mBAAmB,GAAG;AAAA,IACjC,QAAQ;AAAA,IAER;AAEA,qBAAiB;AAAA,MAChB,SAAS,eAAe,OAAO,KAC9B,SAAS,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACvC;AAAA,EACD;AAEA,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAKO,SAAS,4BAA4C;AAC3D,MAAI,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,WAAW,GAAG;AAAA,IAC9B;AAAA,EACD;AACD;","names":["passed"]}
|
|
1
|
+
{"version":3,"sources":["../src/audit.ts","../src/browser-scripts.ts"],"sourcesContent":["import { getSelector, truncateHtml } from \"@a11y-pulse/browser-adaptor/dom\";\nimport type { ElementRef, SkipLinkAuditAdaptor } from \"./adaptor\";\nimport {\n\tactiveElementHandleScript,\n\tfocusScript,\n\tisFocusInsideTargetScript,\n\tprobeActiveElementScript,\n} from \"./browser-scripts\";\nimport type { SkipLinkElementResult, SkipLinkResult } from \"./result\";\n\nexport const DEFAULT_CANDIDATE_LIMIT = 3;\nexport const DEFAULT_ACTIVATION_POLL_MS = 250;\n\nexport type SkipLinkOptions = {\n\t/** Max tab stops to scan for skip-link candidates. Defaults to 3. */\n\tcandidateLimit?: number;\n};\n\nexport type ResolvedSkipLinkOptions = {\n\tcandidateLimit: number;\n\tactivationPollMs: number;\n};\n\nexport type SkipLinkCandidate = {\n\tselector: string;\n\thtml: string;\n\tfragment: string;\n\ttargetResolves: boolean;\n\thandle: ElementRef;\n};\n\nexport type TabStopProbe = {\n\tisBody: boolean;\n\t/** Unique identity of the focused element, used to detect a focus cycle. */\n\tidentity: string;\n\tcandidate: SkipLinkCandidate | null;\n};\n\n/** The browser-coupled seams the loop drives. Mocked in unit tests. */\nexport type SkipLinkProbe = {\n\tpressTab(): Promise<void>;\n\tpressEnter(): Promise<void>;\n\tprobeTabStop(): Promise<TabStopProbe>;\n\tfocusHandle(ref: ElementRef): Promise<void>;\n\tisFocusInsideTarget(fragment: string): Promise<boolean>;\n\tdisposeRef(ref: ElementRef): Promise<void>;\n};\n\nfunction resolveOptions(options: SkipLinkOptions): ResolvedSkipLinkOptions {\n\treturn {\n\t\tcandidateLimit: options.candidateLimit ?? DEFAULT_CANDIDATE_LIMIT,\n\t\tactivationPollMs: DEFAULT_ACTIVATION_POLL_MS,\n\t};\n}\n\n/**\n * Tab through the first few stops looking for skip-link-like fragment anchors, then activate each\n * candidate and check that keyboard focus moves. Enables focus reporting up front, then drives the\n * loop.\n */\nexport async function runSkipLinkAudit(\n\tadaptor: SkipLinkAuditAdaptor,\n\toptions: SkipLinkOptions = {},\n): Promise<SkipLinkResult> {\n\tawait adaptor.ensureFocusReporting();\n\n\treturn runSkipLinkLoop(createAdaptorProbe(adaptor), resolveOptions(options));\n}\n\n/** The engine-neutral two-phase loop. Exported for unit testing with a fake probe. */\nexport async function runSkipLinkLoop(\n\tprobe: SkipLinkProbe,\n\toptions: ResolvedSkipLinkOptions,\n): Promise<SkipLinkResult> {\n\tconst collected: Array<SkipLinkCandidate & { tabIndex: number }> = [];\n\tconst seen = new Set<string>();\n\n\tfor (let i = 0; i < options.candidateLimit; i++) {\n\t\tawait probe.pressTab();\n\n\t\tconst tabStop = await probe.probeTabStop();\n\n\t\tif (tabStop.isBody || seen.has(tabStop.identity)) {\n\t\t\tbreak;\n\t\t}\n\n\t\tseen.add(tabStop.identity);\n\n\t\tif (tabStop.candidate) {\n\t\t\tcollected.push({ ...tabStop.candidate, tabIndex: i + 1 });\n\t\t}\n\t}\n\n\tconst skipLinks: SkipLinkElementResult[] = [];\n\n\tfor (const found of collected) {\n\t\ttry {\n\t\t\tif (!found.targetResolves) {\n\t\t\t\tskipLinks.push({\n\t\t\t\t\tselector: found.selector,\n\t\t\t\t\thtml: found.html,\n\t\t\t\t\tfragment: found.fragment,\n\t\t\t\t\ttabIndex: found.tabIndex,\n\t\t\t\t\tpassed: false,\n\t\t\t\t\tfailureReason: \"target-missing\",\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tawait probe.focusHandle(found.handle);\n\t\t\tawait probe.pressEnter();\n\n\t\t\tlet passed = await pollFocusInsideTarget(probe, found.fragment, options.activationPollMs);\n\n\t\t\tif (!passed) {\n\t\t\t\tawait probe.pressTab();\n\t\t\t\tpassed = await probe.isFocusInsideTarget(found.fragment);\n\t\t\t}\n\n\t\t\tskipLinks.push({\n\t\t\t\tselector: found.selector,\n\t\t\t\thtml: found.html,\n\t\t\t\tfragment: found.fragment,\n\t\t\t\ttabIndex: found.tabIndex,\n\t\t\t\tpassed,\n\t\t\t\tfailureReason: passed ? null : \"activation-no-effect\",\n\t\t\t});\n\t\t} finally {\n\t\t\tawait probe.disposeRef(found.handle);\n\t\t}\n\t}\n\n\tconst passed = skipLinks.filter((link) => link.passed).length;\n\n\treturn {\n\t\tskipLinks,\n\t\tsummary: {\n\t\t\tfound: skipLinks.length,\n\t\t\tpassed,\n\t\t\tfailed: skipLinks.length - passed,\n\t\t},\n\t};\n}\n\nasync function pollFocusInsideTarget(\n\tprobe: SkipLinkProbe,\n\tfragment: string,\n\tpollMs: number,\n): Promise<boolean> {\n\tif (await probe.isFocusInsideTarget(fragment)) {\n\t\treturn true;\n\t}\n\n\tif (pollMs <= 0) {\n\t\treturn false;\n\t}\n\n\tconst deadline = Date.now() + pollMs;\n\n\twhile (Date.now() < deadline) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, 16));\n\n\t\tif (await probe.isFocusInsideTarget(fragment)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction createAdaptorProbe(adaptor: SkipLinkAuditAdaptor): SkipLinkProbe {\n\treturn {\n\t\tpressTab() {\n\t\t\treturn adaptor.pressTab();\n\t\t},\n\n\t\tpressEnter() {\n\t\t\treturn adaptor.pressEnter();\n\t\t},\n\n\t\tasync probeTabStop() {\n\t\t\tconst base = await adaptor.evaluate(probeActiveElementScript);\n\n\t\t\tif (base.isBody) {\n\t\t\t\treturn { isBody: true, identity: \"body\", candidate: null };\n\t\t\t}\n\n\t\t\tconst handle = await adaptor.evaluateHandle(activeElementHandleScript);\n\t\t\tconst selector = await adaptor.evaluate(getSelector, handle);\n\t\t\tconst html = truncateHtml(base.html);\n\n\t\t\tif (base.fragment) {\n\t\t\t\treturn {\n\t\t\t\t\tisBody: false,\n\t\t\t\t\tidentity: selector,\n\t\t\t\t\tcandidate: {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\thtml,\n\t\t\t\t\t\tfragment: base.fragment,\n\t\t\t\t\t\ttargetResolves: base.targetResolves,\n\t\t\t\t\t\thandle,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tawait adaptor.disposeRef(handle);\n\n\t\t\treturn { isBody: false, identity: selector, candidate: null };\n\t\t},\n\n\t\tfocusHandle(ref) {\n\t\t\treturn adaptor.evaluate(focusScript, ref);\n\t\t},\n\n\t\tisFocusInsideTarget(fragment) {\n\t\t\treturn adaptor.evaluate(isFocusInsideTargetScript, fragment);\n\t\t},\n\n\t\tdisposeRef(ref) {\n\t\t\treturn adaptor.disposeRef(ref);\n\t\t},\n\t};\n}\n","/**\n * IMPORTANT: Functions in this file that are serialized and injected into the audited page must not\n * reference any symbols outside their own scope. Common logic (fragment parsing, target resolution,\n * shadow-root descent) is therefore duplicated inside each injected function.\n */\n\n/**\n * Return the in-page fragment for a skip-link-like href, or null if the href is not a same-document\n * hash (including the bare `#` and `#top`, which have no element target).\n */\nexport function parseInPageFragment(href: string | null): string | null {\n\tif (href === null || href === \"\") {\n\t\treturn null;\n\t}\n\n\tif (!href.startsWith(\"#\")) {\n\t\treturn null;\n\t}\n\n\tif (href === \"#\" || href === \"#top\") {\n\t\treturn null;\n\t}\n\n\t// Hash-router and hashbang paths are not element ids.\n\tif (href.startsWith(\"#/\") || href.startsWith(\"#!/\")) {\n\t\treturn null;\n\t}\n\n\treturn href;\n}\n\n/**\n * Resolve a fragment to an element, preferring `id` then a matching `name`. Serialized and run in\n * the page; must stay self-contained.\n */\nexport function resolveFragmentTargetScript(fragment: string): Element | null {\n\tconst raw = fragment.startsWith(\"#\") ? fragment.slice(1) : fragment;\n\tlet decoded = raw;\n\n\ttry {\n\t\tdecoded = decodeURIComponent(raw);\n\t} catch {\n\t\t// Keep the raw id when it is not valid percent-encoding.\n\t}\n\n\treturn document.getElementById(decoded) ?? document.getElementsByName(decoded)[0] ?? null;\n}\n\nexport type SkipLinkActiveElementBase = {\n\tisBody: boolean;\n\thtml: string;\n\t/**\n\t * In-page fragment such as \"#main\", or null when the focused node is not a skip-link candidate.\n\t */\n\tfragment: string | null;\n\ttargetResolves: boolean;\n};\n\n/**\n * Read the currently focused element (descending open shadow roots) and report whether it is a\n * skip-link-like in-page fragment anchor.\n */\nexport function probeActiveElementScript(): SkipLinkActiveElementBase {\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\tif (!el || el === document.body) {\n\t\treturn {\n\t\t\tisBody: true,\n\t\t\thtml: \"\",\n\t\t\tfragment: null,\n\t\t\ttargetResolves: false,\n\t\t};\n\t}\n\n\tconst openingTag = (el.cloneNode(false) as Element).outerHTML;\n\tconst href = el.tagName === \"A\" ? (el as HTMLAnchorElement).getAttribute(\"href\") : null;\n\n\tlet fragment: string | null = null;\n\n\tif (\n\t\thref?.startsWith(\"#\") &&\n\t\thref !== \"#\" &&\n\t\thref !== \"#top\" &&\n\t\t!href.startsWith(\"#/\") &&\n\t\t!href.startsWith(\"#!/\")\n\t) {\n\t\tfragment = href;\n\t}\n\n\tlet targetResolves = false;\n\n\tif (fragment) {\n\t\tconst raw = fragment.slice(1);\n\t\tlet decoded = raw;\n\n\t\ttry {\n\t\t\tdecoded = decodeURIComponent(raw);\n\t\t} catch {\n\t\t\t// Keep the raw id when it is not valid percent-encoding.\n\t\t}\n\n\t\ttargetResolves = Boolean(\n\t\t\tdocument.getElementById(decoded) ?? document.getElementsByName(decoded)[0],\n\t\t);\n\t}\n\n\treturn {\n\t\tisBody: false,\n\t\thtml: openingTag,\n\t\tfragment,\n\t\ttargetResolves,\n\t};\n}\n\n/**\n * Return the focused element, descending open shadow roots.\n */\nexport function activeElementHandleScript(): Element | null {\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\treturn el;\n}\n\n/**\n * Whether document.activeElement is the fragment target or inside it.\n */\nexport function isFocusInsideTargetScript(fragment: string): boolean {\n\tconst raw = fragment.startsWith(\"#\") ? fragment.slice(1) : fragment;\n\tlet decoded = raw;\n\n\ttry {\n\t\tdecoded = decodeURIComponent(raw);\n\t} catch {\n\t\t// Keep the raw id when it is not valid percent-encoding.\n\t}\n\n\tconst target = document.getElementById(decoded) ?? document.getElementsByName(decoded)[0] ?? null;\n\n\tif (!target) {\n\t\treturn false;\n\t}\n\n\tlet el = document.activeElement;\n\n\twhile (el?.shadowRoot?.activeElement) {\n\t\tel = el.shadowRoot.activeElement;\n\t}\n\n\tif (!el) {\n\t\treturn false;\n\t}\n\n\treturn el === target || target.contains(el);\n}\n\nexport function focusScript(el: Element | null): void {\n\t(el as HTMLElement | null)?.focus();\n}\n"],"mappings":";AAAA,SAAS,aAAa,oBAAoB;;;AC8DnC,SAAS,2BAAsD;AACrE,MAAI,KAAK,SAAS;AAElB,SAAO,IAAI,YAAY,eAAe;AACrC,SAAK,GAAG,WAAW;AAAA,EACpB;AAEA,MAAI,CAAC,MAAM,OAAO,SAAS,MAAM;AAChC,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,MACV,gBAAgB;AAAA,IACjB;AAAA,EACD;AAEA,QAAM,aAAc,GAAG,UAAU,KAAK,EAAc;AACpD,QAAM,OAAO,GAAG,YAAY,MAAO,GAAyB,aAAa,MAAM,IAAI;AAEnF,MAAI,WAA0B;AAE9B,MACC,MAAM,WAAW,GAAG,KACpB,SAAS,OACT,SAAS,UACT,CAAC,KAAK,WAAW,IAAI,KACrB,CAAC,KAAK,WAAW,KAAK,GACrB;AACD,eAAW;AAAA,EACZ;AAEA,MAAI,iBAAiB;AAErB,MAAI,UAAU;AACb,UAAM,MAAM,SAAS,MAAM,CAAC;AAC5B,QAAI,UAAU;AAEd,QAAI;AACH,gBAAU,mBAAmB,GAAG;AAAA,IACjC,QAAQ;AAAA,IAER;AAEA,qBAAiB;AAAA,MAChB,SAA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AY,KAAK;AAChB,aAAO,QAAQ,SAAS,aAAa,GAAG;AAAA,IACzC;AAAA,IAEA,oBAAoB,UAAU;AAC7B,aAAO,QAAQ,SAAS,2BAA2B,QAAQ;AAAA,IAC5D;AAAA,IAEA,WAAW,KAAK;AACf,aAAO,QAAQ,WAAW,GAAG;AAAA,IAC9B;AAAA,EACD;AACD;","names":["passed"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a11y-pulse/skip-link-audit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "WCAG 2.4.1 Bypass Blocks audit that finds skip-link-like in-page anchors in the first tab stops and verifies that activating them moves keyboard focus.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
-
"author": "A11y Pulse
|
|
7
|
+
"author": "A11y Pulse",
|
|
8
8
|
"homepage": "https://github.com/A11y-Pulse/audits/tree/main/packages/skip-link-audit#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
+
"source": "./src/index.ts",
|
|
30
31
|
"types": "./dist/index.d.ts",
|
|
31
32
|
"import": "./dist/index.js"
|
|
32
33
|
}
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"@a11y-pulse/browser-adaptor": "*"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"happy-dom": "^20.
|
|
57
|
-
"puppeteer": "^25.
|
|
57
|
+
"happy-dom": "^20.12.0",
|
|
58
|
+
"puppeteer": "^25.10.0"
|
|
58
59
|
}
|
|
59
60
|
}
|