mcp-web-validator 1.3.54 → 1.3.56

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.
@@ -0,0 +1,18 @@
1
+ /** Privacy-preserving reduction of optional axe-core evidence. */
2
+ export declare const MAX_AXE_RULES = 12;
3
+ export interface AxeRuleSummary {
4
+ rule: string;
5
+ impact: "minor" | "moderate" | "serious" | "critical" | "unknown";
6
+ nodes: number;
7
+ }
8
+ export interface AxeSummary {
9
+ status: "complete" | "unavailable";
10
+ engine_version?: string;
11
+ violations: number;
12
+ incomplete: number;
13
+ rules: AxeRuleSummary[];
14
+ rules_truncated: boolean;
15
+ coverage_limited: true;
16
+ }
17
+ export declare function reduceAxeEvidence(raw: unknown): AxeSummary;
18
+ export declare function unavailableAxeEvidence(): AxeSummary;
@@ -0,0 +1,40 @@
1
+ /** Privacy-preserving reduction of optional axe-core evidence. */
2
+ export const MAX_AXE_RULES = 12;
3
+ export function reduceAxeEvidence(raw) {
4
+ if (!raw || typeof raw !== "object")
5
+ throw new Error("Invalid axe evidence");
6
+ const input = raw;
7
+ if (!Array.isArray(input.violations) || !Array.isArray(input.incomplete)) {
8
+ throw new Error("axe evidence missing result lists");
9
+ }
10
+ const rules = [];
11
+ for (const source of input.violations.slice(0, 1_024)) {
12
+ const rule = source;
13
+ if (!rule || typeof rule !== "object"
14
+ || typeof rule.id !== "string" || !/^[a-z][a-z0-9-]{0,59}$/.test(rule.id)
15
+ || !Number.isSafeInteger(rule.nodes) || Number(rule.nodes) < 0) {
16
+ throw new Error("Invalid axe rule evidence");
17
+ }
18
+ const impact = ["minor", "moderate", "serious", "critical"].includes(String(rule.impact))
19
+ ? rule.impact : "unknown";
20
+ if (rules.length < MAX_AXE_RULES) {
21
+ rules.push({ rule: rule.id, impact, nodes: Number(rule.nodes) });
22
+ }
23
+ }
24
+ const version = typeof input.version === "string" && /^\d+\.\d+\.\d+$/.test(input.version)
25
+ ? input.version : undefined;
26
+ return {
27
+ status: "complete",
28
+ ...(version ? { engine_version: version } : {}),
29
+ violations: input.violations.length,
30
+ incomplete: input.incomplete.length,
31
+ rules,
32
+ rules_truncated: input.violations.length > MAX_AXE_RULES,
33
+ coverage_limited: true,
34
+ };
35
+ }
36
+ export function unavailableAxeEvidence() {
37
+ return { status: "unavailable", violations: 0, incomplete: 0,
38
+ rules: [], rules_truncated: false, coverage_limited: true };
39
+ }
40
+ //# sourceMappingURL=axe-review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axe-review.js","sourceRoot":"","sources":["../../../src/modules/browser-ux/axe-review.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAsBhC,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC7E,MAAM,KAAK,GAAG,GAAwE,CAAC;IACvF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,MAAmB,CAAC;QACjC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;eAChC,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;eACtE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,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EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;AAChE,CAAC","sourcesContent":["/** Privacy-preserving reduction of optional axe-core evidence. */\nexport const MAX_AXE_RULES = 12;\n\nexport interface AxeRuleSummary {\n rule: string;\n impact: \"minor\" | \"moderate\" | \"serious\" | \"critical\" | \"unknown\";\n nodes: number;\n}\nexport interface AxeSummary {\n status: \"complete\" | \"unavailable\";\n engine_version?: string;\n violations: number;\n incomplete: number;\n rules: AxeRuleSummary[];\n rules_truncated: boolean;\n coverage_limited: true;\n}\n\ninterface AxeRecord {\n id?: unknown;\n impact?: unknown;\n nodes?: unknown;\n}\nexport function reduceAxeEvidence(raw: unknown): AxeSummary {\n if (!raw || typeof raw !== \"object\") throw new Error(\"Invalid axe evidence\");\n const input = raw as { version?: unknown; violations?: unknown; incomplete?: unknown };\n if (!Array.isArray(input.violations) || !Array.isArray(input.incomplete)) {\n throw new Error(\"axe evidence missing result lists\");\n }\n const rules: AxeRuleSummary[] = [];\n for (const source of input.violations.slice(0, 1_024)) {\n const rule = source as AxeRecord;\n if (!rule || typeof rule !== \"object\"\n || typeof rule.id !== \"string\" || !/^[a-z][a-z0-9-]{0,59}$/.test(rule.id)\n || !Number.isSafeInteger(rule.nodes) || Number(rule.nodes) < 0) {\n throw new Error(\"Invalid axe rule evidence\");\n }\n const impact = [\"minor\", \"moderate\", \"serious\", \"critical\"].includes(String(rule.impact))\n ? rule.impact as AxeRuleSummary[\"impact\"] : \"unknown\";\n if (rules.length < MAX_AXE_RULES) {\n rules.push({ rule: rule.id, impact, nodes: Number(rule.nodes) });\n }\n }\n const version = typeof input.version === \"string\" && /^\\d+\\.\\d+\\.\\d+$/.test(input.version)\n ? input.version : undefined;\n return {\n status: \"complete\",\n ...(version ? { engine_version: version } : {}),\n violations: input.violations.length,\n incomplete: input.incomplete.length,\n rules,\n rules_truncated: input.violations.length > MAX_AXE_RULES,\n coverage_limited: true,\n };\n}\nexport function unavailableAxeEvidence(): AxeSummary {\n return { status: \"unavailable\", violations: 0, incomplete: 0,\n rules: [], rules_truncated: false, coverage_limited: true };\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { type ScreenshotBrowserRuntime } from "../../screenshot.js";
2
+ import { type AxeSummary } from "./axe-review.js";
2
3
  /** P1-12: bounded, browser-backed evidence from an inert, offline HTML sample. */
3
4
  export declare const MAX_WCAG_HTML_BYTES = 180000;
4
5
  export declare const MAX_WCAG_CONTROLS = 120;
@@ -64,12 +65,14 @@ export interface WcagInteractionReview {
64
65
  total_findings: number;
65
66
  findings: WcagFinding[];
66
67
  findings_truncated: boolean;
68
+ axe?: AxeSummary;
67
69
  error?: string;
68
70
  }
69
71
  export interface WcagReviewOptions {
70
72
  viewportWidth?: number;
71
73
  viewportHeight?: number;
72
74
  maxTabSteps?: number;
75
+ includeAxe?: boolean;
73
76
  }
74
77
  export declare function validateWcagInput(html: string, options?: WcagReviewOptions): {
75
78
  width: number;
@@ -1,5 +1,6 @@
1
1
  import { defaultScreenshotBrowserRuntime } from "../../screenshot.js";
2
2
  import { load } from "cheerio";
3
+ import { reduceAxeEvidence, unavailableAxeEvidence } from "./axe-review.js";
3
4
  /** P1-12: bounded, browser-backed evidence from an inert, offline HTML sample. */
4
5
  export const MAX_WCAG_HTML_BYTES = 180_000;
5
6
  export const MAX_WCAG_CONTROLS = 120;
@@ -160,6 +161,9 @@ export async function reviewWcagInteractions(html, options = {}, runtime = defau
160
161
  const strippedScriptCount = $("script").length;
161
162
  $("script,iframe,frame,frameset,object,embed,portal").remove();
162
163
  $('meta[http-equiv="refresh" i]').remove();
164
+ // axe runs as trusted local diagnostics only after author content is made inert.
165
+ if (options.includeAxe)
166
+ $('meta[http-equiv="Content-Security-Policy" i]').remove();
163
167
  $("*").each((_, element) => {
164
168
  if (!("attribs" in element) || !element.attribs)
165
169
  return;
@@ -332,13 +336,48 @@ export async function reviewWcagInteractions(html, options = {}, runtime = defau
332
336
  keyboardIncomplete = true;
333
337
  }
334
338
  }
335
- return analyzeWcagEvidence(snapshot, samples, {
339
+ const result = analyzeWcagEvidence(snapshot, samples, {
336
340
  viewportWidth: config.width, viewportHeight: config.height,
337
341
  resourcesBlocked: blocked, tabSteps,
338
342
  nativeSummariesTested: summariesTested,
339
343
  nativeSummariesToggled: summariesToggled,
340
344
  keyboardIncomplete,
341
345
  });
346
+ if (options.includeAxe) {
347
+ result.axe = unavailableAxeEvidence();
348
+ try {
349
+ const engine = await import("axe-core");
350
+ // Author scripts and event attributes are gone; only our pinned local
351
+ // axe source executes, with the deny-all network interceptor still on.
352
+ await page.setJavaScriptEnabled(true);
353
+ await page.evaluate(engine.default.source);
354
+ const raw = await page.evaluate(async () => {
355
+ const axe = globalThis.axe;
356
+ if (!axe || typeof axe.run !== "function")
357
+ throw new Error("axe unavailable");
358
+ const scan = await axe.run(globalThis.document, {
359
+ runOnly: { type: "tag", values: [
360
+ "wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa",
361
+ ] },
362
+ resultTypes: ["violations", "incomplete"],
363
+ });
364
+ return {
365
+ version: axe.version,
366
+ // Never move user DOM, selectors, URLs, names or HTML across CDP.
367
+ violations: scan.violations.map((v) => ({
368
+ id: v.id, impact: v.impact, nodes: v.nodes?.length ?? 0,
369
+ })),
370
+ incomplete: scan.incomplete.map(() => 0),
371
+ };
372
+ });
373
+ result.axe = reduceAxeEvidence(raw);
374
+ }
375
+ catch {
376
+ // A missing optional package or failed automation is not a clean pass.
377
+ result.axe = unavailableAxeEvidence();
378
+ }
379
+ }
380
+ return result;
342
381
  }
343
382
  catch (cause) {
344
383
  pendingError = cause;
@@ -1 +1 @@
1
- {"version":3,"file":"wcag-interactions.js","sourceRoot":"","sources":["../../../src/modules/browser-ux/wcag-interactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAiC,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,kFAAkF;AAClF,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AAY,GAAG,KAAK,CAAC;QACrB,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,eAAe;YAAE,YAAY,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC;YACH,IAAI,OAAO;gBAAE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY;gBAAE,MAAM,KAAK,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { defaultScreenshotBrowserRuntime, type ScreenshotBrowserRuntime } from \"../../screenshot.js\";\nimport { load } from \"cheerio\";\n\n/** P1-12: bounded, browser-backed evidence from an inert, offline HTML sample. */\nexport const MAX_WCAG_HTML_BYTES = 180_000;\nexport const MAX_WCAG_CONTROLS = 120;\nexport const MAX_WCAG_TAB_STEPS = 24;\nexport const MAX_WCAG_FINDINGS = 12;\nconst DENY_ALL_PROXY = \"http://127.0.0.1:9\";\nconst CONTROL_SELECTOR =\n 'a[href],button,input:not([type=\"hidden\"]),select,textarea,summary,[tabindex],'\n + '[role=\"button\"],[role=\"link\"],[role=\"checkbox\"],[role=\"switch\"],[role=\"tab\"],[role=\"menuitem\"]';\n\nexport const WCAG_FINDING_CODES = [\n \"missing_accessible_name\",\n \"positive_tabindex\",\n \"aria_hidden_focusable\",\n \"custom_role_not_keyboard_focusable\",\n \"potential_focus_indicator_absent\",\n \"focus_outside_viewport\",\n \"summary_enter_not_toggled\",\n] as const;\nexport type WcagFindingCode = typeof WCAG_FINDING_CODES[number];\n\nexport const WCAG_EVIDENCE_TYPES = [\"rendered_dom\", \"keyboard_tab\", \"native_summary\"] as const;\nexport type WcagEvidenceType = typeof WCAG_EVIDENCE_TYPES[number];\n\nexport interface WcagControlEvidence {\n index: number;\n visible: boolean;\n enabled: boolean;\n focusable: boolean;\n name_present: boolean;\n positive_tabindex: boolean;\n aria_hidden: boolean;\n custom_role_without_tab_stop: boolean;\n}\n\nexport interface WcagFocusEvidence {\n index: number;\n outline_or_shadow_present: boolean;\n inside_viewport: boolean;\n opacity_zero: boolean;\n summary: boolean;\n}\n\nexport interface WcagRenderedSnapshot {\n controls_seen: number;\n controls: WcagControlEvidence[];\n page_scripts_present: number;\n}\n\nexport interface WcagFinding {\n code: WcagFindingCode;\n severity: \"warning\" | \"info\";\n evidence: WcagEvidenceType;\n control: number;\n message: string;\n}\n\nexport interface WcagInteractionReview {\n scope: \"offline_sandboxed_rendered_html\";\n browser_executed: boolean;\n scripts_disabled: true;\n viewport_width: number;\n viewport_height: number;\n resources_blocked: number;\n scripts_present: number;\n controls_seen: number;\n controls_inspected: number;\n controls_truncated: boolean;\n visible_controls_without_name: number;\n positive_tabindex_controls: number;\n aria_hidden_focusable_controls: number;\n custom_roles_without_tab_stop: number;\n tab_steps: number;\n unique_tab_targets: number;\n focus_indicator_review_leads: number;\n focus_outside_viewport: number;\n native_summaries_tested: number;\n native_summaries_toggled: number;\n keyboard_sampling_incomplete: boolean;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: WcagFinding[];\n findings_truncated: boolean;\n error?: string;\n}\n\nexport interface WcagReviewOptions {\n viewportWidth?: number;\n viewportHeight?: number;\n maxTabSteps?: number;\n}\n\nfunction boundedViewport(value: number | undefined, fallback: number, min: number, max: number): number {\n const actual = value ?? fallback;\n if (!Number.isSafeInteger(actual) || actual < min || actual > max) {\n throw new Error(\"Unsupported WCAG viewport dimension\");\n }\n return actual;\n}\n\nexport function validateWcagInput(html: string, options: WcagReviewOptions = {}): {\n width: number; height: number; maxTabSteps: number;\n} {\n if (typeof html !== \"string\" || html.trim().length === 0) {\n throw new Error(\"Supply nonempty authorized HTML\");\n }\n if (Buffer.byteLength(html, \"utf8\") > MAX_WCAG_HTML_BYTES) {\n throw new Error(\"HTML exceeds the WCAG byte limit\");\n }\n const maxTabSteps = options.maxTabSteps ?? MAX_WCAG_TAB_STEPS;\n if (!Number.isSafeInteger(maxTabSteps) || maxTabSteps < 1 || maxTabSteps > MAX_WCAG_TAB_STEPS) {\n throw new Error(\"Unsupported keyboard sampling budget\");\n }\n return {\n width: boundedViewport(options.viewportWidth, 960, 320, 1_440),\n height: boundedViewport(options.viewportHeight, 720, 360, 1_080),\n maxTabSteps,\n };\n}\n\nexport function emptyWcagReview(options: WcagReviewOptions = {}): WcagInteractionReview {\n return {\n scope: \"offline_sandboxed_rendered_html\",\n browser_executed: false, scripts_disabled: true,\n viewport_width: options.viewportWidth ?? 960,\n viewport_height: options.viewportHeight ?? 720,\n resources_blocked: 0, scripts_present: 0,\n controls_seen: 0, controls_inspected: 0, controls_truncated: false,\n visible_controls_without_name: 0, positive_tabindex_controls: 0,\n aria_hidden_focusable_controls: 0, custom_roles_without_tab_stop: 0,\n tab_steps: 0, unique_tab_targets: 0, focus_indicator_review_leads: 0,\n focus_outside_viewport: 0, native_summaries_tested: 0,\n native_summaries_toggled: 0, keyboard_sampling_incomplete: false,\n coverage_limited: true,\n limitations: [\n \"The inert Chromium accessibility evidence review could not complete; no browser verification is claimed.\",\n ],\n total_findings: 0, findings: [], findings_truncated: false,\n };\n}\n\n/** Reduce only fixed-shape, no-content browser observations to deterministic findings. */\nexport function analyzeWcagEvidence(\n snapshot: WcagRenderedSnapshot,\n focusSamples: WcagFocusEvidence[],\n options: {\n viewportWidth: number; viewportHeight: number;\n resourcesBlocked?: number; tabSteps?: number;\n nativeSummariesTested?: number; nativeSummariesToggled?: number;\n keyboardIncomplete?: boolean;\n },\n): WcagInteractionReview {\n const out = emptyWcagReview({\n viewportWidth: options.viewportWidth,\n viewportHeight: options.viewportHeight,\n });\n if (!Number.isSafeInteger(snapshot.controls_seen) || snapshot.controls_seen < 0\n || snapshot.controls.length > MAX_WCAG_CONTROLS\n || snapshot.controls_seen < snapshot.controls.length\n || focusSamples.length > MAX_WCAG_TAB_STEPS) {\n throw new Error(\"Invalid browser evidence bounds\");\n }\n out.browser_executed = true;\n out.resources_blocked = Math.max(0, options.resourcesBlocked ?? 0);\n out.scripts_present = Math.max(0, snapshot.page_scripts_present);\n out.controls_seen = snapshot.controls_seen;\n out.controls_inspected = snapshot.controls.length;\n out.controls_truncated = snapshot.controls_seen > snapshot.controls.length;\n out.tab_steps = Math.min(options.tabSteps ?? focusSamples.length, MAX_WCAG_TAB_STEPS);\n out.native_summaries_tested = Math.min(1, options.nativeSummariesTested ?? 0);\n out.native_summaries_toggled = Math.min(out.native_summaries_tested, options.nativeSummariesToggled ?? 0);\n out.keyboard_sampling_incomplete = options.keyboardIncomplete ?? false;\n out.limitations = [\n \"Only supplied HTML in a fresh, script-disabled, offline Chromium page was rendered; external styles, fonts, images, frames and dynamic JavaScript behavior were not loaded or executed.\",\n \"Only up to 120 DOM controls and 24 Tab steps at one viewport were sampled. This is not an exhaustive keyboard path, screen-reader test, accessibility-tree inspection or WCAG conformance assessment.\",\n \"Accessible names and focus visibility are conservative rendered-DOM/computed-style heuristics; CSS background/border indicators, occlusion and all assistive-technology semantics require manual review.\",\n \"Only a focused native <summary> may receive Enter. No links are activated, buttons clicked, form contents changed or submitted, or external resources requested by this tool.\",\n ];\n const all: WcagFinding[] = [];\n function add(code: WcagFindingCode, severity: \"warning\" | \"info\",\n evidence: WcagEvidenceType, index: number, message: string) {\n all.push({ code, severity, evidence, control: index, message });\n }\n const inspected = new Set<number>();\n for (const item of snapshot.controls) {\n if (!Number.isSafeInteger(item.index) || item.index < 1\n || item.index > MAX_WCAG_CONTROLS || inspected.has(item.index)) {\n throw new Error(\"Invalid control evidence index\");\n }\n inspected.add(item.index);\n if (!item.visible || !item.enabled) continue;\n if (!item.name_present) {\n out.visible_controls_without_name++;\n add(\"missing_accessible_name\", \"warning\", \"rendered_dom\", item.index,\n \"This visible control lacks a recognized accessible-name signal; verify the actual accessibility tree.\");\n }\n if (item.positive_tabindex) {\n out.positive_tabindex_controls++;\n add(\"positive_tabindex\", \"warning\", \"rendered_dom\", item.index,\n \"A positive tabindex may reorder keyboard navigation; review intentional keyboard order.\");\n }\n if (item.aria_hidden && item.focusable) {\n out.aria_hidden_focusable_controls++;\n add(\"aria_hidden_focusable\", \"warning\", \"rendered_dom\", item.index,\n \"A keyboard-focusable control is inside aria-hidden content; this may hide it from assistive technology.\");\n }\n if (item.custom_role_without_tab_stop) {\n out.custom_roles_without_tab_stop++;\n add(\"custom_role_not_keyboard_focusable\", \"warning\", \"rendered_dom\", item.index,\n \"A custom interactive role has no native or declared Tab stop; check actual keyboard operation.\");\n }\n }\n const unique = new Set<number>();\n for (const item of focusSamples) {\n if (!Number.isSafeInteger(item.index) || item.index < 1 || !inspected.has(item.index)\n || unique.has(item.index)) continue;\n unique.add(item.index);\n if ((!item.outline_or_shadow_present || item.opacity_zero)) {\n out.focus_indicator_review_leads++;\n add(\"potential_focus_indicator_absent\", \"info\", \"keyboard_tab\", item.index,\n \"After Tab, no computed outline/shadow or an opacity-zero state was observed; a different focus indicator may exist.\");\n }\n if (!item.inside_viewport) {\n out.focus_outside_viewport++;\n add(\"focus_outside_viewport\", \"info\", \"keyboard_tab\", item.index,\n \"The sampled Tab focus target did not intersect the viewport; verify visibility and page scrolling.\");\n }\n }\n out.unique_tab_targets = unique.size;\n if (out.native_summaries_tested && !out.native_summaries_toggled) {\n const summary = focusSamples.find((item) => item.summary);\n add(\"summary_enter_not_toggled\", \"warning\", \"native_summary\", summary?.index ?? 1,\n \"Enter did not toggle the sampled native details summary in the isolated browser.\");\n }\n all.sort((a, b) => (a.severity === b.severity ? 0 : a.severity === \"warning\" ? -1 : 1)\n || a.control - b.control || a.code.localeCompare(b.code));\n out.total_findings = all.length;\n out.findings = all.slice(0, MAX_WCAG_FINDINGS);\n out.findings_truncated = all.length > MAX_WCAG_FINDINGS;\n return out;\n}\n\n/**\n * Offline Chromium checks of supplied HTML: scripts disabled, network requests\n * aborted, no link clicks, no form submissions, no browser profile reuse.\n * The only Enter keypress is on a focused native HTML summary element.\n */\nexport async function reviewWcagInteractions(\n html: string,\n options: WcagReviewOptions = {},\n runtime: ScreenshotBrowserRuntime = defaultScreenshotBrowserRuntime,\n): Promise<WcagInteractionReview> {\n const config = validateWcagInput(html, options);\n // Defense-in-depth: even with Chromium scripting explicitly disabled, do\n // not instantiate untrusted script, embedded frames or refresh navigation.\n const $ = load(html);\n const strippedScriptCount = $(\"script\").length;\n $(\"script,iframe,frame,frameset,object,embed,portal\").remove();\n $('meta[http-equiv=\"refresh\" i]').remove();\n $(\"*\").each((_, element) => {\n if (!(\"attribs\" in element) || !element.attribs) return;\n for (const name of Object.keys(element.attribs)) {\n if (/^on[a-z]+$/iu.test(name)) $(element).removeAttr(name);\n }\n });\n const inertHtml = $.html();\n let browser: Awaited<ReturnType<ScreenshotBrowserRuntime[\"launch\"]>> | undefined;\n let pendingError: unknown;\n let browserDeadline: ReturnType<typeof setTimeout> | undefined;\n try {\n // The pinned screenshot runtime launches a fresh sandboxed Chromium process.\n // Port 9 is deliberately not serviced: the transport cannot reach page URLs.\n browser = await runtime.launch(DENY_ALL_PROXY);\n // A hard deadline also covers keyboard/evaluation operations, which are\n // not governed by Puppeteer's navigation timeout.\n browserDeadline = setTimeout(() => {\n void browser?.close().catch(() => {});\n }, 20_000);\n browserDeadline.unref?.();\n const page = await browser.newPage();\n page.setDefaultTimeout(5_000);\n page.setDefaultNavigationTimeout(8_000);\n await page.setViewport({ width: config.width, height: config.height, deviceScaleFactor: 1 });\n await page.setJavaScriptEnabled(false);\n let blocked = 0;\n await page.setRequestInterception(true);\n page.on(\"request\", (request) => {\n blocked++;\n void request.abort(\"blockedbyclient\").catch(() => {});\n });\n await page.setContent(inertHtml, { waitUntil: \"domcontentloaded\", timeout: 8_000 });\n\n // All browser-side data is reduced to booleans/counts, never raw HTML/text,\n // attributes, CSS properties, input values, URLs, IDs or names.\n const snapshot = await page.evaluate((selector: string, cap: number) => {\n const dom = (globalThis as any).document;\n const compute = (globalThis as any).getComputedStyle;\n const all: any[] = Array.from(dom.querySelectorAll(selector));\n const controls: WcagControlEvidence[] = [];\n for (let i = 0; i < Math.min(all.length, cap); i++) {\n const element = all[i];\n const styles = compute(element);\n const box = element.getBoundingClientRect();\n const visible = styles.display !== \"none\" &&\n styles.visibility !== \"hidden\" && styles.visibility !== \"collapse\" &&\n box.width > 0 && box.height > 0 && !element.closest(\"[hidden],[inert]\");\n const tag = String(element.tagName).toLowerCase();\n const type = String(element.getAttribute(\"type\") ?? \"\").toLowerCase();\n const role = String(element.getAttribute(\"role\") ?? \"\").toLowerCase();\n const native = [\"button\", \"input\", \"select\", \"textarea\", \"a\", \"summary\"].includes(tag);\n const customRole = [\"button\", \"link\", \"checkbox\", \"switch\", \"tab\", \"menuitem\"].includes(role);\n const nonempty = (value: unknown) => typeof value === \"string\" && value.trim().length > 0;\n const describedBy = String(element.getAttribute(\"aria-labelledby\") ?? \"\")\n .split(/\\s+/u).filter(Boolean).some((id) =>\n nonempty(dom.getElementById(id)?.textContent));\n const ariaLabel = nonempty(element.getAttribute(\"aria-label\"));\n const associatedLabel = Boolean(element.labels &&\n Array.from(element.labels).some((label: any) => nonempty(label.textContent)));\n const labelWrapping = nonempty(element.closest(\"label\")?.textContent);\n const title = nonempty(element.getAttribute(\"title\"));\n const text = [\"a\", \"button\", \"summary\"].includes(tag) && nonempty(element.textContent);\n const alt = [\"a\", \"button\"].includes(tag) &&\n Array.from(element.querySelectorAll(\"img\")).some((image: any) => nonempty(image.getAttribute(\"alt\")));\n const inputAlt = tag === \"input\" && type === \"image\" && nonempty(element.getAttribute(\"alt\"));\n // Submit/reset have user-agent default names; input[type=button]\n // without a value does not have that same fallback.\n const nativeSubmit = tag === \"input\" && ([\"submit\", \"reset\"].includes(type)\n || (type === \"button\" && nonempty(element.value)));\n controls.push({\n index: i + 1,\n visible: Boolean(visible),\n enabled: !element.disabled && !element.closest(\"fieldset[disabled]\"),\n focusable: visible && element.tabIndex >= 0,\n name_present: Boolean(describedBy || ariaLabel || associatedLabel ||\n labelWrapping || title || text || alt || inputAlt || nativeSubmit),\n positive_tabindex: element.tabIndex > 0,\n aria_hidden: Boolean(element.closest('[aria-hidden=\"true\" i]')),\n custom_role_without_tab_stop: Boolean(customRole && !native && element.tabIndex < 0),\n });\n }\n return {\n controls_seen: all.length,\n controls,\n page_scripts_present: dom.querySelectorAll(\"script\").length,\n } as WcagRenderedSnapshot;\n }, CONTROL_SELECTOR, MAX_WCAG_CONTROLS);\n snapshot.page_scripts_present += strippedScriptCount;\n\n const samples: WcagFocusEvidence[] = [];\n const focused = new Set<number>();\n let tabSteps = 0;\n let keyboardIncomplete = false;\n let summaryIndex: number | undefined;\n // Autofocus in supplied markup should not skip the first Tab stop.\n await page.evaluate(() => { (globalThis as any).document.activeElement?.blur?.(); });\n try {\n const maxSteps = Math.min(config.maxTabSteps, Math.max(2, snapshot.controls_seen + 1));\n for (let i = 0; i < maxSteps; i++) {\n await page.keyboard.press(\"Tab\");\n tabSteps++;\n const entry = await page.evaluate((selector: string, cap: number) => {\n const dom = (globalThis as any).document;\n const compute = (globalThis as any).getComputedStyle;\n const current = dom.activeElement;\n if (!current) return null;\n const all: any[] = Array.from(dom.querySelectorAll(selector));\n const index = all.indexOf(current) + 1;\n if (index < 1 || index > cap) return null;\n const style = compute(current);\n const rect = current.getBoundingClientRect();\n const outline = style.outlineStyle !== \"none\" &&\n Number.parseFloat(style.outlineWidth) > 0;\n const shadow = style.boxShadow && style.boxShadow !== \"none\";\n const viewportWidth = (globalThis as any).innerWidth;\n const viewportHeight = (globalThis as any).innerHeight;\n return {\n index,\n outline_or_shadow_present: Boolean(outline || shadow),\n inside_viewport: Boolean(rect.width > 0 && rect.height > 0 &&\n rect.bottom > 0 && rect.right > 0 &&\n rect.left < viewportWidth && rect.top < viewportHeight),\n opacity_zero: Number.parseFloat(style.opacity) === 0,\n summary: String(current.tagName).toLowerCase() === \"summary\",\n } as WcagFocusEvidence;\n }, CONTROL_SELECTOR, MAX_WCAG_CONTROLS);\n if (!entry) {\n // The browser has left the sampled control set or no focus occurred.\n if (snapshot.controls_seen > MAX_WCAG_CONTROLS) keyboardIncomplete = true;\n break;\n }\n if (focused.has(entry.index)) break; // Wraparound is not a trap.\n focused.add(entry.index);\n samples.push(entry);\n if (entry.summary && summaryIndex === undefined) {\n summaryIndex = entry.index;\n }\n }\n } catch {\n keyboardIncomplete = true;\n }\n\n let summariesTested = 0;\n let summariesToggled = 0;\n if (summaryIndex !== undefined) {\n try {\n // Only focus the *same* native summary reached by Tab, not an unrelated\n // earlier summary that might be hidden or nested in an inactive widget.\n const summaryReady = await page.evaluate((selector: string, index: number) => {\n const dom = (globalThis as any).document;\n const s: any = dom.querySelectorAll(selector)[index - 1];\n if (!s || String(s.tagName).toLowerCase() !== \"summary\"\n || String(s.parentElement?.tagName).toLowerCase() !== \"details\") return false;\n (s as any).focus();\n return dom.activeElement === s;\n }, CONTROL_SELECTOR, summaryIndex);\n if (summaryReady) {\n summariesTested = 1;\n const before = await page.evaluate(() =>\n Boolean((globalThis as any).document.activeElement?.closest(\"details\")?.open));\n await page.keyboard.press(\"Enter\");\n const after = await page.evaluate(() =>\n Boolean((globalThis as any).document.activeElement?.closest(\"details\")?.open));\n summariesToggled = before !== after ? 1 : 0;\n }\n } catch {\n keyboardIncomplete = true;\n }\n }\n return analyzeWcagEvidence(snapshot, samples, {\n viewportWidth: config.width, viewportHeight: config.height,\n resourcesBlocked: blocked, tabSteps,\n nativeSummariesTested: summariesTested,\n nativeSummariesToggled: summariesToggled,\n keyboardIncomplete,\n });\n } catch (cause) {\n pendingError = cause;\n throw cause;\n } finally {\n if (browserDeadline) clearTimeout(browserDeadline);\n try {\n if (browser) await browser.close();\n } catch (cause) {\n if (!pendingError) throw cause;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"wcag-interactions.js","sourceRoot":"","sources":["../../../src/modules/browser-ux/wcag-interactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAiC,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE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E,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;yBACxD,CAAC,CAAC;wBACH,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;qBACzC,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,MAAM,CAAC,GAAG,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;YACtC,CAAC;YAAC,MAAM,CAAC;gBACP,uEAAuE;gBACvE,MAAM,CAAC,GAAG,GAAG,sBAAsB,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,GAAG,KAAK,CAAC;QACrB,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,eAAe;YAAE,YAAY,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC;YACH,IAAI,OAAO;gBAAE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY;gBAAE,MAAM,KAAK,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { defaultScreenshotBrowserRuntime, type ScreenshotBrowserRuntime } from \"../../screenshot.js\";\nimport { load } from \"cheerio\";\nimport { reduceAxeEvidence, unavailableAxeEvidence, type AxeSummary } from \"./axe-review.js\";\n\n/** P1-12: bounded, browser-backed evidence from an inert, offline HTML sample. */\nexport const MAX_WCAG_HTML_BYTES = 180_000;\nexport const MAX_WCAG_CONTROLS = 120;\nexport const MAX_WCAG_TAB_STEPS = 24;\nexport const MAX_WCAG_FINDINGS = 12;\nconst DENY_ALL_PROXY = \"http://127.0.0.1:9\";\nconst CONTROL_SELECTOR =\n 'a[href],button,input:not([type=\"hidden\"]),select,textarea,summary,[tabindex],'\n + '[role=\"button\"],[role=\"link\"],[role=\"checkbox\"],[role=\"switch\"],[role=\"tab\"],[role=\"menuitem\"]';\n\nexport const WCAG_FINDING_CODES = [\n \"missing_accessible_name\",\n \"positive_tabindex\",\n \"aria_hidden_focusable\",\n \"custom_role_not_keyboard_focusable\",\n \"potential_focus_indicator_absent\",\n \"focus_outside_viewport\",\n \"summary_enter_not_toggled\",\n] as const;\nexport type WcagFindingCode = typeof WCAG_FINDING_CODES[number];\n\nexport const WCAG_EVIDENCE_TYPES = [\"rendered_dom\", \"keyboard_tab\", \"native_summary\"] as const;\nexport type WcagEvidenceType = typeof WCAG_EVIDENCE_TYPES[number];\n\nexport interface WcagControlEvidence {\n index: number;\n visible: boolean;\n enabled: boolean;\n focusable: boolean;\n name_present: boolean;\n positive_tabindex: boolean;\n aria_hidden: boolean;\n custom_role_without_tab_stop: boolean;\n}\n\nexport interface WcagFocusEvidence {\n index: number;\n outline_or_shadow_present: boolean;\n inside_viewport: boolean;\n opacity_zero: boolean;\n summary: boolean;\n}\n\nexport interface WcagRenderedSnapshot {\n controls_seen: number;\n controls: WcagControlEvidence[];\n page_scripts_present: number;\n}\n\nexport interface WcagFinding {\n code: WcagFindingCode;\n severity: \"warning\" | \"info\";\n evidence: WcagEvidenceType;\n control: number;\n message: string;\n}\n\nexport interface WcagInteractionReview {\n scope: \"offline_sandboxed_rendered_html\";\n browser_executed: boolean;\n scripts_disabled: true;\n viewport_width: number;\n viewport_height: number;\n resources_blocked: number;\n scripts_present: number;\n controls_seen: number;\n controls_inspected: number;\n controls_truncated: boolean;\n visible_controls_without_name: number;\n positive_tabindex_controls: number;\n aria_hidden_focusable_controls: number;\n custom_roles_without_tab_stop: number;\n tab_steps: number;\n unique_tab_targets: number;\n focus_indicator_review_leads: number;\n focus_outside_viewport: number;\n native_summaries_tested: number;\n native_summaries_toggled: number;\n keyboard_sampling_incomplete: boolean;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: WcagFinding[];\n findings_truncated: boolean;\n axe?: AxeSummary;\n error?: string;\n}\n\nexport interface WcagReviewOptions {\n viewportWidth?: number;\n viewportHeight?: number;\n maxTabSteps?: number;\n includeAxe?: boolean;\n}\n\nfunction boundedViewport(value: number | undefined, fallback: number, min: number, max: number): number {\n const actual = value ?? fallback;\n if (!Number.isSafeInteger(actual) || actual < min || actual > max) {\n throw new Error(\"Unsupported WCAG viewport dimension\");\n }\n return actual;\n}\n\nexport function validateWcagInput(html: string, options: WcagReviewOptions = {}): {\n width: number; height: number; maxTabSteps: number;\n} {\n if (typeof html !== \"string\" || html.trim().length === 0) {\n throw new Error(\"Supply nonempty authorized HTML\");\n }\n if (Buffer.byteLength(html, \"utf8\") > MAX_WCAG_HTML_BYTES) {\n throw new Error(\"HTML exceeds the WCAG byte limit\");\n }\n const maxTabSteps = options.maxTabSteps ?? MAX_WCAG_TAB_STEPS;\n if (!Number.isSafeInteger(maxTabSteps) || maxTabSteps < 1 || maxTabSteps > MAX_WCAG_TAB_STEPS) {\n throw new Error(\"Unsupported keyboard sampling budget\");\n }\n return {\n width: boundedViewport(options.viewportWidth, 960, 320, 1_440),\n height: boundedViewport(options.viewportHeight, 720, 360, 1_080),\n maxTabSteps,\n };\n}\n\nexport function emptyWcagReview(options: WcagReviewOptions = {}): WcagInteractionReview {\n return {\n scope: \"offline_sandboxed_rendered_html\",\n browser_executed: false, scripts_disabled: true,\n viewport_width: options.viewportWidth ?? 960,\n viewport_height: options.viewportHeight ?? 720,\n resources_blocked: 0, scripts_present: 0,\n controls_seen: 0, controls_inspected: 0, controls_truncated: false,\n visible_controls_without_name: 0, positive_tabindex_controls: 0,\n aria_hidden_focusable_controls: 0, custom_roles_without_tab_stop: 0,\n tab_steps: 0, unique_tab_targets: 0, focus_indicator_review_leads: 0,\n focus_outside_viewport: 0, native_summaries_tested: 0,\n native_summaries_toggled: 0, keyboard_sampling_incomplete: false,\n coverage_limited: true,\n limitations: [\n \"The inert Chromium accessibility evidence review could not complete; no browser verification is claimed.\",\n ],\n total_findings: 0, findings: [], findings_truncated: false,\n };\n}\n\n/** Reduce only fixed-shape, no-content browser observations to deterministic findings. */\nexport function analyzeWcagEvidence(\n snapshot: WcagRenderedSnapshot,\n focusSamples: WcagFocusEvidence[],\n options: {\n viewportWidth: number; viewportHeight: number;\n resourcesBlocked?: number; tabSteps?: number;\n nativeSummariesTested?: number; nativeSummariesToggled?: number;\n keyboardIncomplete?: boolean;\n },\n): WcagInteractionReview {\n const out = emptyWcagReview({\n viewportWidth: options.viewportWidth,\n viewportHeight: options.viewportHeight,\n });\n if (!Number.isSafeInteger(snapshot.controls_seen) || snapshot.controls_seen < 0\n || snapshot.controls.length > MAX_WCAG_CONTROLS\n || snapshot.controls_seen < snapshot.controls.length\n || focusSamples.length > MAX_WCAG_TAB_STEPS) {\n throw new Error(\"Invalid browser evidence bounds\");\n }\n out.browser_executed = true;\n out.resources_blocked = Math.max(0, options.resourcesBlocked ?? 0);\n out.scripts_present = Math.max(0, snapshot.page_scripts_present);\n out.controls_seen = snapshot.controls_seen;\n out.controls_inspected = snapshot.controls.length;\n out.controls_truncated = snapshot.controls_seen > snapshot.controls.length;\n out.tab_steps = Math.min(options.tabSteps ?? focusSamples.length, MAX_WCAG_TAB_STEPS);\n out.native_summaries_tested = Math.min(1, options.nativeSummariesTested ?? 0);\n out.native_summaries_toggled = Math.min(out.native_summaries_tested, options.nativeSummariesToggled ?? 0);\n out.keyboard_sampling_incomplete = options.keyboardIncomplete ?? false;\n out.limitations = [\n \"Only supplied HTML in a fresh, script-disabled, offline Chromium page was rendered; external styles, fonts, images, frames and dynamic JavaScript behavior were not loaded or executed.\",\n \"Only up to 120 DOM controls and 24 Tab steps at one viewport were sampled. This is not an exhaustive keyboard path, screen-reader test, accessibility-tree inspection or WCAG conformance assessment.\",\n \"Accessible names and focus visibility are conservative rendered-DOM/computed-style heuristics; CSS background/border indicators, occlusion and all assistive-technology semantics require manual review.\",\n \"Only a focused native <summary> may receive Enter. No links are activated, buttons clicked, form contents changed or submitted, or external resources requested by this tool.\",\n ];\n const all: WcagFinding[] = [];\n function add(code: WcagFindingCode, severity: \"warning\" | \"info\",\n evidence: WcagEvidenceType, index: number, message: string) {\n all.push({ code, severity, evidence, control: index, message });\n }\n const inspected = new Set<number>();\n for (const item of snapshot.controls) {\n if (!Number.isSafeInteger(item.index) || item.index < 1\n || item.index > MAX_WCAG_CONTROLS || inspected.has(item.index)) {\n throw new Error(\"Invalid control evidence index\");\n }\n inspected.add(item.index);\n if (!item.visible || !item.enabled) continue;\n if (!item.name_present) {\n out.visible_controls_without_name++;\n add(\"missing_accessible_name\", \"warning\", \"rendered_dom\", item.index,\n \"This visible control lacks a recognized accessible-name signal; verify the actual accessibility tree.\");\n }\n if (item.positive_tabindex) {\n out.positive_tabindex_controls++;\n add(\"positive_tabindex\", \"warning\", \"rendered_dom\", item.index,\n \"A positive tabindex may reorder keyboard navigation; review intentional keyboard order.\");\n }\n if (item.aria_hidden && item.focusable) {\n out.aria_hidden_focusable_controls++;\n add(\"aria_hidden_focusable\", \"warning\", \"rendered_dom\", item.index,\n \"A keyboard-focusable control is inside aria-hidden content; this may hide it from assistive technology.\");\n }\n if (item.custom_role_without_tab_stop) {\n out.custom_roles_without_tab_stop++;\n add(\"custom_role_not_keyboard_focusable\", \"warning\", \"rendered_dom\", item.index,\n \"A custom interactive role has no native or declared Tab stop; check actual keyboard operation.\");\n }\n }\n const unique = new Set<number>();\n for (const item of focusSamples) {\n if (!Number.isSafeInteger(item.index) || item.index < 1 || !inspected.has(item.index)\n || unique.has(item.index)) continue;\n unique.add(item.index);\n if ((!item.outline_or_shadow_present || item.opacity_zero)) {\n out.focus_indicator_review_leads++;\n add(\"potential_focus_indicator_absent\", \"info\", \"keyboard_tab\", item.index,\n \"After Tab, no computed outline/shadow or an opacity-zero state was observed; a different focus indicator may exist.\");\n }\n if (!item.inside_viewport) {\n out.focus_outside_viewport++;\n add(\"focus_outside_viewport\", \"info\", \"keyboard_tab\", item.index,\n \"The sampled Tab focus target did not intersect the viewport; verify visibility and page scrolling.\");\n }\n }\n out.unique_tab_targets = unique.size;\n if (out.native_summaries_tested && !out.native_summaries_toggled) {\n const summary = focusSamples.find((item) => item.summary);\n add(\"summary_enter_not_toggled\", \"warning\", \"native_summary\", summary?.index ?? 1,\n \"Enter did not toggle the sampled native details summary in the isolated browser.\");\n }\n all.sort((a, b) => (a.severity === b.severity ? 0 : a.severity === \"warning\" ? -1 : 1)\n || a.control - b.control || a.code.localeCompare(b.code));\n out.total_findings = all.length;\n out.findings = all.slice(0, MAX_WCAG_FINDINGS);\n out.findings_truncated = all.length > MAX_WCAG_FINDINGS;\n return out;\n}\n\n/**\n * Offline Chromium checks of supplied HTML: scripts disabled, network requests\n * aborted, no link clicks, no form submissions, no browser profile reuse.\n * The only Enter keypress is on a focused native HTML summary element.\n */\nexport async function reviewWcagInteractions(\n html: string,\n options: WcagReviewOptions = {},\n runtime: ScreenshotBrowserRuntime = defaultScreenshotBrowserRuntime,\n): Promise<WcagInteractionReview> {\n const config = validateWcagInput(html, options);\n // Defense-in-depth: even with Chromium scripting explicitly disabled, do\n // not instantiate untrusted script, embedded frames or refresh navigation.\n const $ = load(html);\n const strippedScriptCount = $(\"script\").length;\n $(\"script,iframe,frame,frameset,object,embed,portal\").remove();\n $('meta[http-equiv=\"refresh\" i]').remove();\n // axe runs as trusted local diagnostics only after author content is made inert.\n if (options.includeAxe) $('meta[http-equiv=\"Content-Security-Policy\" i]').remove();\n $(\"*\").each((_, element) => {\n if (!(\"attribs\" in element) || !element.attribs) return;\n for (const name of Object.keys(element.attribs)) {\n if (/^on[a-z]+$/iu.test(name)) $(element).removeAttr(name);\n }\n });\n const inertHtml = $.html();\n let browser: Awaited<ReturnType<ScreenshotBrowserRuntime[\"launch\"]>> | undefined;\n let pendingError: unknown;\n let browserDeadline: ReturnType<typeof setTimeout> | undefined;\n try {\n // The pinned screenshot runtime launches a fresh sandboxed Chromium process.\n // Port 9 is deliberately not serviced: the transport cannot reach page URLs.\n browser = await runtime.launch(DENY_ALL_PROXY);\n // A hard deadline also covers keyboard/evaluation operations, which are\n // not governed by Puppeteer's navigation timeout.\n browserDeadline = setTimeout(() => {\n void browser?.close().catch(() => {});\n }, 20_000);\n browserDeadline.unref?.();\n const page = await browser.newPage();\n page.setDefaultTimeout(5_000);\n page.setDefaultNavigationTimeout(8_000);\n await page.setViewport({ width: config.width, height: config.height, deviceScaleFactor: 1 });\n await page.setJavaScriptEnabled(false);\n let blocked = 0;\n await page.setRequestInterception(true);\n page.on(\"request\", (request) => {\n blocked++;\n void request.abort(\"blockedbyclient\").catch(() => {});\n });\n await page.setContent(inertHtml, { waitUntil: \"domcontentloaded\", timeout: 8_000 });\n\n // All browser-side data is reduced to booleans/counts, never raw HTML/text,\n // attributes, CSS properties, input values, URLs, IDs or names.\n const snapshot = await page.evaluate((selector: string, cap: number) => {\n const dom = (globalThis as any).document;\n const compute = (globalThis as any).getComputedStyle;\n const all: any[] = Array.from(dom.querySelectorAll(selector));\n const controls: WcagControlEvidence[] = [];\n for (let i = 0; i < Math.min(all.length, cap); i++) {\n const element = all[i];\n const styles = compute(element);\n const box = element.getBoundingClientRect();\n const visible = styles.display !== \"none\" &&\n styles.visibility !== \"hidden\" && styles.visibility !== \"collapse\" &&\n box.width > 0 && box.height > 0 && !element.closest(\"[hidden],[inert]\");\n const tag = String(element.tagName).toLowerCase();\n const type = String(element.getAttribute(\"type\") ?? \"\").toLowerCase();\n const role = String(element.getAttribute(\"role\") ?? \"\").toLowerCase();\n const native = [\"button\", \"input\", \"select\", \"textarea\", \"a\", \"summary\"].includes(tag);\n const customRole = [\"button\", \"link\", \"checkbox\", \"switch\", \"tab\", \"menuitem\"].includes(role);\n const nonempty = (value: unknown) => typeof value === \"string\" && value.trim().length > 0;\n const describedBy = String(element.getAttribute(\"aria-labelledby\") ?? \"\")\n .split(/\\s+/u).filter(Boolean).some((id) =>\n nonempty(dom.getElementById(id)?.textContent));\n const ariaLabel = nonempty(element.getAttribute(\"aria-label\"));\n const associatedLabel = Boolean(element.labels &&\n Array.from(element.labels).some((label: any) => nonempty(label.textContent)));\n const labelWrapping = nonempty(element.closest(\"label\")?.textContent);\n const title = nonempty(element.getAttribute(\"title\"));\n const text = [\"a\", \"button\", \"summary\"].includes(tag) && nonempty(element.textContent);\n const alt = [\"a\", \"button\"].includes(tag) &&\n Array.from(element.querySelectorAll(\"img\")).some((image: any) => nonempty(image.getAttribute(\"alt\")));\n const inputAlt = tag === \"input\" && type === \"image\" && nonempty(element.getAttribute(\"alt\"));\n // Submit/reset have user-agent default names; input[type=button]\n // without a value does not have that same fallback.\n const nativeSubmit = tag === \"input\" && ([\"submit\", \"reset\"].includes(type)\n || (type === \"button\" && nonempty(element.value)));\n controls.push({\n index: i + 1,\n visible: Boolean(visible),\n enabled: !element.disabled && !element.closest(\"fieldset[disabled]\"),\n focusable: visible && element.tabIndex >= 0,\n name_present: Boolean(describedBy || ariaLabel || associatedLabel ||\n labelWrapping || title || text || alt || inputAlt || nativeSubmit),\n positive_tabindex: element.tabIndex > 0,\n aria_hidden: Boolean(element.closest('[aria-hidden=\"true\" i]')),\n custom_role_without_tab_stop: Boolean(customRole && !native && element.tabIndex < 0),\n });\n }\n return {\n controls_seen: all.length,\n controls,\n page_scripts_present: dom.querySelectorAll(\"script\").length,\n } as WcagRenderedSnapshot;\n }, CONTROL_SELECTOR, MAX_WCAG_CONTROLS);\n snapshot.page_scripts_present += strippedScriptCount;\n\n const samples: WcagFocusEvidence[] = [];\n const focused = new Set<number>();\n let tabSteps = 0;\n let keyboardIncomplete = false;\n let summaryIndex: number | undefined;\n // Autofocus in supplied markup should not skip the first Tab stop.\n await page.evaluate(() => { (globalThis as any).document.activeElement?.blur?.(); });\n try {\n const maxSteps = Math.min(config.maxTabSteps, Math.max(2, snapshot.controls_seen + 1));\n for (let i = 0; i < maxSteps; i++) {\n await page.keyboard.press(\"Tab\");\n tabSteps++;\n const entry = await page.evaluate((selector: string, cap: number) => {\n const dom = (globalThis as any).document;\n const compute = (globalThis as any).getComputedStyle;\n const current = dom.activeElement;\n if (!current) return null;\n const all: any[] = Array.from(dom.querySelectorAll(selector));\n const index = all.indexOf(current) + 1;\n if (index < 1 || index > cap) return null;\n const style = compute(current);\n const rect = current.getBoundingClientRect();\n const outline = style.outlineStyle !== \"none\" &&\n Number.parseFloat(style.outlineWidth) > 0;\n const shadow = style.boxShadow && style.boxShadow !== \"none\";\n const viewportWidth = (globalThis as any).innerWidth;\n const viewportHeight = (globalThis as any).innerHeight;\n return {\n index,\n outline_or_shadow_present: Boolean(outline || shadow),\n inside_viewport: Boolean(rect.width > 0 && rect.height > 0 &&\n rect.bottom > 0 && rect.right > 0 &&\n rect.left < viewportWidth && rect.top < viewportHeight),\n opacity_zero: Number.parseFloat(style.opacity) === 0,\n summary: String(current.tagName).toLowerCase() === \"summary\",\n } as WcagFocusEvidence;\n }, CONTROL_SELECTOR, MAX_WCAG_CONTROLS);\n if (!entry) {\n // The browser has left the sampled control set or no focus occurred.\n if (snapshot.controls_seen > MAX_WCAG_CONTROLS) keyboardIncomplete = true;\n break;\n }\n if (focused.has(entry.index)) break; // Wraparound is not a trap.\n focused.add(entry.index);\n samples.push(entry);\n if (entry.summary && summaryIndex === undefined) {\n summaryIndex = entry.index;\n }\n }\n } catch {\n keyboardIncomplete = true;\n }\n\n let summariesTested = 0;\n let summariesToggled = 0;\n if (summaryIndex !== undefined) {\n try {\n // Only focus the *same* native summary reached by Tab, not an unrelated\n // earlier summary that might be hidden or nested in an inactive widget.\n const summaryReady = await page.evaluate((selector: string, index: number) => {\n const dom = (globalThis as any).document;\n const s: any = dom.querySelectorAll(selector)[index - 1];\n if (!s || String(s.tagName).toLowerCase() !== \"summary\"\n || String(s.parentElement?.tagName).toLowerCase() !== \"details\") return false;\n (s as any).focus();\n return dom.activeElement === s;\n }, CONTROL_SELECTOR, summaryIndex);\n if (summaryReady) {\n summariesTested = 1;\n const before = await page.evaluate(() =>\n Boolean((globalThis as any).document.activeElement?.closest(\"details\")?.open));\n await page.keyboard.press(\"Enter\");\n const after = await page.evaluate(() =>\n Boolean((globalThis as any).document.activeElement?.closest(\"details\")?.open));\n summariesToggled = before !== after ? 1 : 0;\n }\n } catch {\n keyboardIncomplete = true;\n }\n }\n const result = analyzeWcagEvidence(snapshot, samples, {\n viewportWidth: config.width, viewportHeight: config.height,\n resourcesBlocked: blocked, tabSteps,\n nativeSummariesTested: summariesTested,\n nativeSummariesToggled: summariesToggled,\n keyboardIncomplete,\n });\n if (options.includeAxe) {\n result.axe = unavailableAxeEvidence();\n try {\n const engine = await import(\"axe-core\");\n // Author scripts and event attributes are gone; only our pinned local\n // axe source executes, with the deny-all network interceptor still on.\n await page.setJavaScriptEnabled(true);\n await page.evaluate(engine.default.source);\n const raw = await page.evaluate(async () => {\n const axe = (globalThis as any).axe;\n if (!axe || typeof axe.run !== \"function\") throw new Error(\"axe unavailable\");\n const scan = await axe.run((globalThis as any).document, {\n runOnly: { type: \"tag\", values: [\n \"wcag2a\", \"wcag2aa\", \"wcag21a\", \"wcag21aa\", \"wcag22aa\",\n ] },\n resultTypes: [\"violations\", \"incomplete\"],\n });\n return {\n version: axe.version,\n // Never move user DOM, selectors, URLs, names or HTML across CDP.\n violations: scan.violations.map((v: any) => ({\n id: v.id, impact: v.impact, nodes: v.nodes?.length ?? 0,\n })),\n incomplete: scan.incomplete.map(() => 0),\n };\n });\n result.axe = reduceAxeEvidence(raw);\n } catch {\n // A missing optional package or failed automation is not a clean pass.\n result.axe = unavailableAxeEvidence();\n }\n }\n return result;\n } catch (cause) {\n pendingError = cause;\n throw cause;\n } finally {\n if (browserDeadline) clearTimeout(browserDeadline);\n try {\n if (browser) await browser.close();\n } catch (cause) {\n if (!pendingError) throw cause;\n }\n }\n}\n"]}
@@ -41,12 +41,12 @@ export declare function htmlValidationContent(messages: W3CMessage[], source?: s
41
41
  error: number;
42
42
  warning: number;
43
43
  info: number;
44
- }): string;
44
+ }, checker?: "w3c_remote" | "nu_local"): string;
45
45
  export declare function cssValidationContent(messages: CSSMessage[], totalMessages?: number, counts?: {
46
46
  error: number;
47
47
  warning?: number;
48
48
  compatibilityLimitation: number;
49
- }): string;
49
+ }, checker?: "w3c_remote" | "stylelint_local"): string;
50
50
  export declare function seoAuditContent(issues: SEOIssue[], totalIssues: number, truncated: boolean, counts?: AuditCounts): string;
51
51
  export declare function schemaValidationContent(issues: SEOIssue[], totalIssues: number, truncated: boolean, htmlContent: string): string;
52
52
  export declare function linkCheckContent(links: LinkStatus[], baseUrl?: string): string;
@@ -229,7 +229,8 @@ export function availabilityReviewContent(review) {
229
229
  nextStep,
230
230
  });
231
231
  }
232
- export function htmlValidationContent(messages, source, totalMessages = messages.length, counts) {
232
+ export function htmlValidationContent(messages, source, totalMessages = messages.length, counts, checker = "w3c_remote") {
233
+ const validatorLabel = checker === "nu_local" ? "The local Nu HTML Checker" : "The W3C validator";
233
234
  const errorCount = counts?.error
234
235
  ?? messages.filter((message) => getW3CMessageSeverity(message) === "error").length;
235
236
  const warningCount = counts?.warning
@@ -240,7 +241,7 @@ export function htmlValidationContent(messages, source, totalMessages = messages
240
241
  return toolContent({
241
242
  title: "HTML validation",
242
243
  status: "clean",
243
- outcome: `The W3C validator returned no HTML diagnostics${sourceText}.`,
244
+ outcome: validatorLabel + " returned no HTML diagnostics" + sourceText + ".",
244
245
  nextStep: "Keep this result as a baseline and validate again after the next markup change.",
245
246
  });
246
247
  }
@@ -248,7 +249,9 @@ export function htmlValidationContent(messages, source, totalMessages = messages
248
249
  return toolContent({
249
250
  title: "HTML validation",
250
251
  status: hasActionableDiagnostics ? "attention needed" : "review suggested",
251
- outcome: `The W3C validator returned ${countLabel(errorCount, "error")}, ${countLabel(warningCount, "warning")}, and ${countLabel(infoCount, "informational diagnostic")}${sourceText}.`,
252
+ outcome: validatorLabel + " returned " + countLabel(errorCount, "error") + ", "
253
+ + countLabel(warningCount, "warning") + ", and "
254
+ + countLabel(infoCount, "informational diagnostic") + sourceText + ".",
252
255
  actions: messages.map((message) => ({
253
256
  priority: priorityForSeverity(getW3CMessageSeverity(message)),
254
257
  message: message.message,
@@ -262,12 +265,15 @@ export function htmlValidationContent(messages, source, totalMessages = messages
262
265
  : undefined,
263
266
  });
264
267
  }
265
- export function cssValidationContent(messages, totalMessages = messages.length, counts) {
268
+ export function cssValidationContent(messages, totalMessages = messages.length, counts, checker = "w3c_remote") {
269
+ const stylelint = checker === "stylelint_local";
266
270
  if (totalMessages === 0) {
267
271
  return toolContent({
268
272
  title: "CSS validation",
269
- status: "clean",
270
- outcome: "The W3C validator returned no CSS errors or warnings.",
273
+ status: stylelint ? "no lint findings" : "clean",
274
+ outcome: stylelint
275
+ ? "Local Stylelint found no findings in the selected quality rules; W3C CSS conformance was not tested."
276
+ : "The W3C validator returned no CSS errors or warnings.",
271
277
  nextStep: "Validate again after the next stylesheet change.",
272
278
  });
273
279
  }
@@ -281,7 +287,10 @@ export function cssValidationContent(messages, totalMessages = messages.length,
281
287
  return toolContent({
282
288
  title: "CSS validation",
283
289
  status: actionableErrors > 0 ? "attention needed" : "review suggested",
284
- outcome: `The W3C validator returned ${countLabel(actionableErrors, "CSS error")}, ${countLabel(warningCount, "CSS warning")}, and ${countLabel(compatibilityLimitationCount, "known validator limitation")}.`,
290
+ outcome: (stylelint ? "Local Stylelint found " : "The W3C validator returned ")
291
+ + countLabel(actionableErrors, "CSS error") + ", "
292
+ + countLabel(warningCount, "CSS warning") + ", and "
293
+ + countLabel(compatibilityLimitationCount, "known validator limitation") + ".",
285
294
  actions: messages.map((message) => ({
286
295
  priority: message.compatibility === "known-validator-limitation"
287
296
  ? 2
@@ -299,7 +308,9 @@ export function cssValidationContent(messages, totalMessages = messages.length,
299
308
  ? "Jigsaw currently does not recognize the standards-defined @container rule. The upstream diagnostic is preserved and marked as a known validator limitation."
300
309
  : undefined,
301
310
  totalMessages > messages.length
302
- ? `Showing the first ${messages.length} of ${totalMessages} CSS diagnostics in structured output; summary counts include all returned Jigsaw diagnostics.`
311
+ ? "Showing the first " + messages.length + " of " + totalMessages
312
+ + " CSS diagnostics in structured output; summary counts include all returned "
313
+ + (stylelint ? "Stylelint" : "Jigsaw") + " diagnostics."
303
314
  : undefined,
304
315
  ].filter(Boolean).join(" ") || undefined,
305
316
  });
@@ -482,7 +493,7 @@ export function contentQualityContent(analysis) {
482
493
  ? `${countLabel(analysis.total_findings, "potential content-quality finding")} across ${analysis.eligible_pages}/${analysis.sampled_pages} sampled pages.`
483
494
  : `No checked content-quality signals were found across ${analysis.eligible_pages}/${analysis.sampled_pages} sampled pages. This is not a usefulness or site-wide verdict.`,
484
495
  actions: analysis.findings.map((finding) => ({
485
- priority: finding.severity === "warning" ? 1 : 2,
496
+ priority: (finding.severity === "warning" ? 1 : 2),
486
497
  location: finding.example_urls.join(", "),
487
498
  message: `${finding.code}: ${finding.message}`,
488
499
  })),
@@ -594,20 +605,30 @@ export function metadataConsistencyContent(analysis) {
594
605
  }
595
606
  export function wcagInteractionsContent(review) {
596
607
  const warnings = review.findings.filter((finding) => finding.severity === "warning").length;
608
+ const axeInfo = review.axe ? " Automated axe-core: " + review.axe.status
609
+ + (review.axe.status === "complete"
610
+ ? ", " + review.axe.violations + " failed rule groups, " + review.axe.incomplete + " incomplete review groups."
611
+ : "; checks unavailable, no passing result claimed.") : "";
612
+ const axeActions = review.axe?.status === "complete"
613
+ ? review.axe.rules.map((item) => ({
614
+ priority: (item.impact === "serious" || item.impact === "critical" ? 1 : 2),
615
+ location: "axe-core rule",
616
+ message: item.rule + ": " + item.nodes + " affected elements (" + item.impact + ").",
617
+ })) : [];
597
618
  return toolContent({
598
619
  title: "Browser keyboard and WCAG evidence",
599
- status: warnings ? "attention needed" : "partial",
620
+ status: warnings || (review.axe?.violations ?? 0) > 0 ? "attention needed" : "partial",
600
621
  outcome: `In script-disabled, offline Chromium, ${review.controls_inspected} of ${review.controls_seen} ` +
601
622
  `controls were sampled at ${review.viewport_width} × ${review.viewport_height}; ` +
602
623
  `${review.tab_steps} Tab key steps covered ${review.unique_tab_targets} distinct targets. ` +
603
624
  `${review.visible_controls_without_name} accessible-name review leads, ` +
604
625
  `${review.focus_indicator_review_leads} possible focus-indicator gaps, ` +
605
- `${review.native_summaries_toggled}/${review.native_summaries_tested} native summaries toggled with Enter.`,
606
- actions: review.findings.map((finding) => ({
607
- priority: finding.severity === "warning" ? 1 : 2,
608
- location: `Rendered control ${finding.control} · ${finding.evidence}`,
609
- message: `${finding.code}: ${finding.message}`,
610
- })),
626
+ `${review.native_summaries_toggled}/${review.native_summaries_tested} native summaries toggled with Enter.` + axeInfo,
627
+ actions: [...review.findings.map((finding) => ({
628
+ priority: (finding.severity === "warning" ? 1 : 2),
629
+ location: `Rendered control ${finding.control} · ${finding.evidence}`,
630
+ message: `${finding.code}: ${finding.message}`,
631
+ })), ...axeActions],
611
632
  nextStep: "Recheck the flagged focus/name signals in a fully styled, authorized website with JavaScript enabled and a screen reader. This inert sample is not an accessibility audit or WCAG 2.2 compliance determination.",
612
633
  });
613
634
  }