@a11y-pulse/disclosure-operability-audit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/audit.ts","../src/browser-scripts.ts","../src/classify.ts"],"sourcesContent":["import {\n\ttype BrowserAdaptor,\n\treleaseStashedElements,\n\tstashedElementSelectors,\n} from \"@a11y-pulse/browser-adaptor\";\nimport { truncateHtml } from \"@a11y-pulse/browser-adaptor/dom\";\nimport {\n\ttype CollectedTrigger,\n\tcallDisclosureScript,\n\ttype DisclosureAction,\n\ttype DisclosureApi,\n\ttype DisclosureCollection,\n\ttype DisclosureReading,\n\tinstallDisclosureScript,\n\tisDisclosureInstalledScript,\n} from \"./browser-scripts\";\nimport {\n\tclassifyTrigger,\n\ttype DisclosureAttempt,\n\ttype DisclosureKey,\n\ttype DisclosureObservation,\n\ttype DisclosureRestore,\n} from \"./classify\";\nimport type { DisclosureOperabilityResult, DisclosureSkipped, DisclosureTrigger } from \"./result\";\n\nexport const DEFAULT_TRIGGER_LIMIT = 20;\nexport const DEFAULT_ACTIVATION_TIMEOUT_MS = 250;\n\n/**\n * Names the audit will not activate, as the source of a case-insensitive pattern. A control that\n * carries `aria-expanded` but is named for an action that cannot be undone is left alone: the\n * audit cannot tell what its handler does until it has run.\n */\nexport const DEFAULT_RISKY_NAME_PATTERN =\n\t\"\\\\b(delete|remove|erase|log\\\\s?out|sign\\\\s?out|unsubscribe|pay|buy|purchase|send|order\\\\s+now|(place|confirm|complete|submit)\\\\s+(your\\\\s+|my\\\\s+)?order)\\\\b\";\n\n/** How many skipped triggers to list. */\nconst SKIP_LIMIT = 10;\n\n/** Pages with more elements than this are not scanned for content appearing outside `aria-controls`. */\nconst SCAN_LIMIT = 5000;\n\nconst POLL_INTERVAL_MS = 25;\n\n/**\n * The longest a trigger is given to finish what it started: a handler that ran but has not acted\n * yet, or a transition still playing. Pressing a key into a panel that is mid-transition is how a\n * working toggle gets reported as stuck.\n */\nconst SETTLE_LIMIT_MS = 1000;\n\n/** How long the page is watched untouched, to tell a change the audit caused from one it did not. */\nconst IDLE_WATCH_MS = 50;\n\nconst STASH_KEY = \"__a11yPulseDisclosure\";\n\nexport type DisclosureOperabilityOptions = {\n\t/**\n\t * Max triggers to operate. A page with more is sampled evenly from top to bottom. Defaults to\n\t * 20.\n\t */\n\ttriggerLimit?: number;\n\t/**\n\t * How long to wait, in milliseconds, for a key press to change something before deciding that it\n\t * did nothing. Defaults to 250.\n\t */\n\tactivationTimeout?: number;\n\t/**\n\t * Source of a case-insensitive pattern. A trigger whose accessible name matches is listed in\n\t * `skipped` as `risky-name` and never activated. Defaults to `DEFAULT_RISKY_NAME_PATTERN`; pass\n\t * null to operate every trigger whatever it is called.\n\t */\n\triskyNamePattern?: string | null;\n\t/**\n\t * Also operate buttons that have `aria-controls` naming hidden content and no `aria-expanded`.\n\t * Off by default: without `aria-expanded` nothing says the button is a disclosure, and\n\t * operating it runs whatever its handler does.\n\t */\n\tincludeControlsOnly?: boolean;\n};\n\n/** Thrown by a probe when the document the audit started on has been replaced. */\nexport class DocumentReplacedError extends Error {\n\tconstructor() {\n\t\tsuper(\"The document was replaced while a disclosure trigger was being operated\");\n\t\tthis.name = \"DocumentReplacedError\";\n\t}\n}\n\n/** The browser-coupled seams the audit drives. Faked in unit tests. */\nexport type DisclosureProbe = {\n\t/** Record the page as it stands before trigger `index` is touched. */\n\tbegin(index: number): Promise<DisclosureReading>;\n\t/** Focus the trigger. Resolves to whether it took focus. */\n\tfocus(index: number): Promise<boolean>;\n\tread(index: number): Promise<DisclosureReading>;\n\t/** Whether a key press or a click on the trigger would land where it is meant to. */\n\tready(index: number, action: DisclosureAction): Promise<boolean>;\n\tblur(index: number): Promise<void>;\n\tpressKey(key: DisclosureKey | \"Escape\"): Promise<void>;\n\t/** A scripted click on the trigger. */\n\tclick(index: number): Promise<void>;\n\t/** Scripted pointer events entering (`on`) or leaving the trigger. */\n\thover(index: number, on: boolean): Promise<void>;\n\t/** Put scrolling back as it was when the trigger was begun. */\n\tend(index: number): Promise<void>;\n\tsleep(ms: number): Promise<void>;\n};\n\ntype Exercise = {\n\tprobe: DisclosureProbe;\n\tindex: number;\n\ttimeout: number;\n\tinitial: DisclosureReading;\n\t/** False when the page changes by itself, so only the trigger's own attributes are trusted. */\n\tstable: boolean;\n};\n\nclass TriggerRemoved extends Error {}\n\nfunction pageDiff({ stable }: Exercise, reading: DisclosureReading): number {\n\treturn stable ? (reading.appeared ?? 0) + (reading.disappeared ?? 0) : 0;\n}\n\nfunction contentChanged(exercise: Exercise, from: DisclosureReading, to: DisclosureReading) {\n\treturn from.controlled !== to.controlled || pageDiff(exercise, from) !== pageDiff(exercise, to);\n}\n\nfunction differs(exercise: Exercise, from: DisclosureReading, to: DisclosureReading): boolean {\n\treturn from.expanded !== to.expanded || contentChanged(exercise, from, to);\n}\n\n/**\n * Read until `done` holds or the timeout runs out. Past the timeout it keeps reading for as long\n * as `extend` says the trigger is still busy, up to the settle limit. Resolves to the last reading.\n */\nasync function poll(\n\texercise: Exercise,\n\ttimeout: number,\n\tdone: (reading: DisclosureReading) => boolean,\n\textend?: (reading: DisclosureReading) => boolean,\n): Promise<DisclosureReading> {\n\tconst { probe, index } = exercise;\n\tlet reading = await probe.read(index);\n\n\tfor (let waited = 0; ; waited += POLL_INTERVAL_MS) {\n\t\tif (!reading.connected) {\n\t\t\tthrow new TriggerRemoved();\n\t\t}\n\n\t\tif (done(reading)) {\n\t\t\treturn reading;\n\t\t}\n\n\t\tif (waited >= timeout && !(waited < SETTLE_LIMIT_MS && extend?.(reading))) {\n\t\t\treturn reading;\n\t\t}\n\n\t\tawait probe.sleep(POLL_INTERVAL_MS);\n\t\treading = await probe.read(index);\n\t}\n}\n\n/** Wait for a transition or a resizing panel to come to rest, so the next key is not swallowed. */\nasync function awaitSettled(exercise: Exercise): Promise<void> {\n\tconst { probe, index } = exercise;\n\tlet calm = 0;\n\n\tfor (let waited = 0; waited < SETTLE_LIMIT_MS; waited += POLL_INTERVAL_MS) {\n\t\tconst reading = await probe.read(index);\n\n\t\tif (!reading.connected) {\n\t\t\tthrow new TriggerRemoved();\n\t\t}\n\n\t\tcalm = reading.settling ? 0 : calm + 1;\n\n\t\tif (calm >= 2) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait probe.sleep(POLL_INTERVAL_MS);\n\t}\n}\n\n/**\n * Wait for a key press or click to change the trigger. A state that flips before its panel has\n * begun to animate, or the reverse, is given the rest of the timeout to catch up. `clicksBefore`\n * is the trigger's click count before a key was pressed: once the key has clicked it, a handler is\n * known to have run and is given the settle limit to act.\n */\nasync function awaitChange(\n\texercise: Exercise,\n\ttimeout: number,\n\tclicksBefore: number | null = null,\n): Promise<DisclosureReading> {\n\tconst { initial } = exercise;\n\tconst started = Date.now();\n\tconst busy = (reading: DisclosureReading) =>\n\t\treading.settling || (clicksBefore !== null && reading.clicks > clicksBefore);\n\tconst first = await poll(\n\t\texercise,\n\t\ttimeout,\n\t\t(reading) => differs(exercise, initial, reading),\n\t\tbusy,\n\t);\n\n\t// A trigger with no aria-expanded has no state to wait for.\n\tif (!differs(exercise, initial, first) || initial.expanded === null) {\n\t\treturn first;\n\t}\n\n\tconst both = (reading: DisclosureReading) =>\n\t\treading.expanded !== initial.expanded && contentChanged(exercise, initial, reading);\n\n\treturn poll(\n\t\texercise,\n\t\tMath.max(0, timeout - (Date.now() - started)),\n\t\tboth,\n\t\t(reading) => reading.settling,\n\t);\n}\n\n/**\n * Give the trigger keyboard focus and confirm it kept it. A page that hands focus elsewhere, as a\n * dialog's focus trap does, may do so a moment after the trigger is focused, so focus is checked\n * again after a pause. A key is only ever pressed when this resolves to true.\n */\nasync function focusForKey({ probe, index }: Exercise): Promise<boolean> {\n\tif (!(await probe.focus(index))) {\n\t\treturn false;\n\t}\n\n\tawait probe.sleep(POLL_INTERVAL_MS);\n\n\treturn probe.ready(index, \"key\");\n}\n\n/**\n * Put a changed trigger back as it was found: with the key that changed it, then Escape, then a\n * click. Escape goes first when the popup has taken focus, since a key press would land in it.\n *\n * Enter and Space are only pressed while the trigger holds focus, and it is only clicked while\n * focus has not moved elsewhere and no modal dialog is in the way. When what opened keeps focus\n * to itself, Escape is all that is tried and the trigger is reported as not restored.\n */\nasync function restore(\n\texercise: Exercise,\n\tfirst: DisclosureRestore,\n): Promise<DisclosureRestore | null> {\n\tconst { probe, index, initial, timeout } = exercise;\n\tconst restored = (reading: DisclosureReading) => !differs(exercise, initial, reading);\n\n\t/** Resolves to false when the step was not safe to take, and so was not taken. */\n\tconst act = async (step: DisclosureRestore): Promise<boolean> => {\n\t\tif (step === \"blur\") {\n\t\t\tawait probe.blur(index);\n\t\t} else if (step === \"Escape\") {\n\t\t\tawait probe.pressKey(\"Escape\");\n\t\t} else if (step === \"click\") {\n\t\t\tif (!(await probe.ready(index, \"click\"))) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tawait probe.click(index);\n\t\t} else {\n\t\t\tif (!(await focusForKey(exercise))) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tawait probe.pressKey(step);\n\t\t}\n\n\t\treturn true;\n\t};\n\n\tconst now = await probe.read(index);\n\tconst order: DisclosureRestore[] =\n\t\tfirst === \"Enter\" || first === \"Space\"\n\t\t\t? now.focused\n\t\t\t\t? [first, \"Escape\", \"click\"]\n\t\t\t\t: [\"Escape\", first, \"click\"]\n\t\t\t: [first, \"Escape\", \"click\"];\n\n\tfor (const step of new Set(order)) {\n\t\tconst { clicks } = await probe.read(index);\n\n\t\tif (!(await act(step))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// A click, or a key that clicked the trigger, ran a handler: give it time to act.\n\t\tconst busy = (reading: DisclosureReading) =>\n\t\t\treading.settling || step === \"click\" || reading.clicks > clicks;\n\n\t\tif (restored(await poll(exercise, timeout, restored, busy))) {\n\t\t\tawait awaitSettled(exercise);\n\n\t\t\treturn step;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction keysFor(trigger: CollectedTrigger): DisclosureKey[] {\n\t// Space scrolls the page on a link rather than activating it.\n\treturn trigger.link && !trigger.spaceExpected ? [\"Enter\"] : [\"Enter\", \"Space\"];\n}\n\ntype Exercised = { observation: DisclosureObservation; keysTried: DisclosureKey[] };\n\n/** Operate one trigger with the keyboard, then with a pointer if the keyboard did nothing. */\nasync function exerciseTrigger(\n\tprobe: DisclosureProbe,\n\tindex: number,\n\ttrigger: CollectedTrigger,\n\ttimeout: number,\n): Promise<Exercised> {\n\tconst observation: DisclosureObservation = {\n\t\tfocusable: false,\n\t\tinTabOrder: trigger.inTabOrder,\n\t\tinComposite: trigger.inComposite,\n\t\tspaceExpected: trigger.spaceExpected,\n\t\topenedOnFocus: null,\n\t\tattempts: [],\n\t\tpointer: { click: null, hover: null },\n\t\tblocked: { submit: false, navigation: false },\n\t\tremoved: false,\n\t\tnavigated: false,\n\t\trestored: true,\n\t};\n\tconst attempts: DisclosureAttempt[] = [];\n\tconst keysTried: DisclosureKey[] = [];\n\tconst done = (): Exercised => ({ observation: { ...observation, attempts }, keysTried });\n\n\tconst noteBlocked = ({ blocked }: DisclosureReading): boolean => {\n\t\tobservation.blocked.submit ||= blocked.submits > 0;\n\t\tobservation.blocked.navigation ||= blocked.navigations > 0;\n\n\t\treturn blocked.submits > 0 || blocked.navigations > 0;\n\t};\n\n\tconst operate = async (): Promise<void> => {\n\t\tconst initial = await probe.begin(index);\n\n\t\tif (!initial.connected) {\n\t\t\tthrow new TriggerRemoved();\n\t\t}\n\n\t\tconst exercise: Exercise = { probe, index, timeout, initial, stable: true };\n\n\t\tawait probe.sleep(IDLE_WATCH_MS);\n\t\texercise.stable = pageDiff(exercise, await probe.read(index)) === 0;\n\n\t\tconst changedFromInitial = (reading: DisclosureReading) => differs(exercise, initial, reading);\n\t\tconst pointerTimeout = Math.min(timeout, 150);\n\n\t\tconst tryHover = async (): Promise<void> => {\n\t\t\tawait probe.hover(index, true);\n\t\t\tobservation.pointer.hover = changedFromInitial(await awaitChange(exercise, pointerTimeout));\n\t\t\tawait probe.hover(index, false);\n\n\t\t\tif (observation.pointer.hover) {\n\t\t\t\tconst closed = await poll(\n\t\t\t\t\texercise,\n\t\t\t\t\ttimeout,\n\t\t\t\t\t(reading) => !changedFromInitial(reading),\n\t\t\t\t\t(reading) => reading.settling,\n\t\t\t\t);\n\n\t\t\t\tobservation.restored =\n\t\t\t\t\t!changedFromInitial(closed) || (await restore(exercise, \"Escape\")) !== null;\n\t\t\t}\n\t\t};\n\n\t\tconst tryPointer = async (): Promise<void> => {\n\t\t\tif (!(await probe.ready(index, \"click\"))) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait probe.click(index);\n\n\t\t\tconst clicked = await awaitChange(exercise, pointerTimeout);\n\n\t\t\tobservation.pointer.click = changedFromInitial(clicked);\n\n\t\t\tif (noteBlocked(clicked)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (observation.pointer.click) {\n\t\t\t\tawait awaitSettled(exercise);\n\t\t\t\tobservation.restored = (await restore(exercise, \"click\")) !== null;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait tryHover();\n\t\t};\n\n\t\tconst exerciseKeys = async (): Promise<void> => {\n\t\t\tobservation.focusable = await probe.focus(index);\n\n\t\t\tif (!observation.focusable) {\n\t\t\t\tawait tryPointer();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst afterFocus = await poll(exercise, IDLE_WATCH_MS, changedFromInitial);\n\n\t\t\tif (changedFromInitial(afterFocus)) {\n\t\t\t\tobservation.openedOnFocus = { expandedChanged: afterFocus.expanded !== initial.expanded };\n\t\t\t\tobservation.restored = (await restore(exercise, \"blur\")) !== null;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/** Set when a key clicked the trigger and nothing came of it: a handler ran to no effect. */\n\t\t\tlet clickedToNoEffect = false;\n\n\t\t\tfor (const key of keysFor(trigger)) {\n\t\t\t\t// Never press a key that could land anywhere but on the trigger.\n\t\t\t\tif (!(await focusForKey(exercise))) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { clicks } = await probe.read(index);\n\n\t\t\t\tkeysTried.push(key);\n\t\t\t\tawait probe.pressKey(key);\n\n\t\t\t\tconst after = await awaitChange(exercise, timeout, clicks);\n\t\t\t\tconst attempt: DisclosureAttempt = {\n\t\t\t\t\tkey,\n\t\t\t\t\texpandedBefore: initial.expanded,\n\t\t\t\t\texpandedAfter: after.expanded,\n\t\t\t\t\tcontentChanged: contentChanged(exercise, initial, after),\n\t\t\t\t\trestoredBy: null,\n\t\t\t\t};\n\n\t\t\t\tattempts.push(attempt);\n\n\t\t\t\tconst stopped = noteBlocked(after);\n\n\t\t\t\tif (changedFromInitial(after)) {\n\t\t\t\t\tawait awaitSettled(exercise);\n\t\t\t\t\tattempt.restoredBy = await restore(exercise, key);\n\n\t\t\t\t\tif (attempt.restoredBy === null) {\n\t\t\t\t\t\tobservation.restored = false;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else if (after.clicks > clicks) {\n\t\t\t\t\t// The other key, and a scripted click, would only run the same handler again.\n\t\t\t\t\tclickedToNoEffect = true;\n\t\t\t\t}\n\n\t\t\t\tif (stopped) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (clickedToNoEffect) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (attempts.some((attempt) => attempt.restoredBy !== null)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clickedToNoEffect) {\n\t\t\t\t// The key already clicked it, so what a click does is known.\n\t\t\t\tobservation.pointer.click = false;\n\t\t\t\tawait tryHover();\n\t\t\t} else {\n\t\t\t\tawait tryPointer();\n\t\t\t}\n\t\t};\n\n\t\tawait exerciseKeys();\n\n\t\t// A change that arrived after the audit stopped waiting for it would otherwise be left\n\t\t// behind unreported. Only the trigger's own state is trusted this late.\n\t\tconst last = await probe.read(index);\n\n\t\tif (!last.connected) {\n\t\t\tthrow new TriggerRemoved();\n\t\t}\n\n\t\tnoteBlocked(last);\n\n\t\tif (\n\t\t\tobservation.restored &&\n\t\t\t(last.expanded !== initial.expanded || last.controlled !== initial.controlled)\n\t\t) {\n\t\t\tobservation.restored = (await restore(exercise, keysTried.at(-1) ?? \"click\")) !== null;\n\t\t}\n\t};\n\n\ttry {\n\t\tawait operate();\n\t} catch (error) {\n\t\tif (error instanceof TriggerRemoved) {\n\t\t\tobservation.removed = true;\n\n\t\t\t// The trigger cannot be operated again, so Escape is the one thing left that may close\n\t\t\t// whatever it opened.\n\t\t\ttry {\n\t\t\t\tawait probe.pressKey(\"Escape\");\n\t\t\t} catch {\n\t\t\t\t// Best effort.\n\t\t\t}\n\t\t} else if (error instanceof DocumentReplacedError) {\n\t\t\tobservation.navigated = true;\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tif (!observation.navigated) {\n\t\ttry {\n\t\t\tawait probe.end(index);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof DocumentReplacedError)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tobservation.navigated = true;\n\t\t}\n\t}\n\n\treturn done();\n}\n\nexport type DisclosureLoopResult = {\n\texercised: Exercised[];\n\tstopped: \"navigated\" | null;\n};\n\n/** The engine-neutral loop over the collected triggers. Exported for unit testing with a fake probe. */\nexport async function runDisclosureLoop(\n\tprobe: DisclosureProbe,\n\ttriggers: readonly CollectedTrigger[],\n\ttimeout: number,\n): Promise<DisclosureLoopResult> {\n\tconst exercised: Exercised[] = [];\n\n\tfor (const [index, trigger] of triggers.entries()) {\n\t\tconst outcome = await exerciseTrigger(probe, index, trigger, timeout);\n\n\t\texercised.push(outcome);\n\n\t\tif (outcome.observation.navigated) {\n\t\t\treturn { exercised, stopped: \"navigated\" };\n\t\t}\n\t}\n\n\treturn { exercised, stopped: null };\n}\n\nfunction createAdaptorProbe(adaptor: BrowserAdaptor): DisclosureProbe {\n\tconst call = async <T>(method: keyof DisclosureApi, ...args: unknown[]): Promise<T> => {\n\t\tlet answer: unknown;\n\n\t\ttry {\n\t\t\tanswer = await adaptor.evaluate(callDisclosureScript, STASH_KEY, method, ...args);\n\t\t} catch (error) {\n\t\t\t// A navigation in flight fails the call outright. Tell that apart from a real error by\n\t\t\t// asking the page, once it has settled, whether the audit's functions survived.\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\n\t\t\tlet installed = false;\n\n\t\t\ttry {\n\t\t\t\tinstalled = await adaptor.evaluate(isDisclosureInstalledScript, STASH_KEY);\n\t\t\t} catch {\n\t\t\t\t// Still navigating.\n\t\t\t}\n\n\t\t\tif (installed) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthrow new DocumentReplacedError();\n\t\t}\n\n\t\tif (answer !== null && typeof answer === \"object\" && \"gone\" in answer) {\n\t\t\tthrow new DocumentReplacedError();\n\t\t}\n\n\t\treturn answer as T;\n\t};\n\n\treturn {\n\t\tbegin: (index) => call(\"begin\", index),\n\t\tfocus: (index) => call(\"focus\", index),\n\t\tread: (index) => call(\"read\", index),\n\t\tready: (index, action) => call(\"ready\", index, action),\n\t\tblur: (index) => call(\"blur\", index),\n\t\tpressKey: (key) => adaptor.pressKey(key),\n\t\tclick: (index) => call(\"click\", index),\n\t\thover: (index, on) => call(\"hover\", index, on),\n\t\tend: (index) => call(\"end\", index),\n\t\tsleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),\n\t};\n}\n\nasync function selectorsFor(\n\tadaptor: BrowserAdaptor,\n\tcollection: DisclosureCollection,\n): Promise<{ triggers: string[]; controls: (string | null)[]; skipped: string[] }> {\n\tconst count = collection.triggers.length;\n\tconst all = await stashedElementSelectors(\n\t\tadaptor,\n\t\tSTASH_KEY,\n\t\tArray.from({ length: count + collection.skipped.length }, (_, i) => i),\n\t);\n\n\tconst withControls = collection.triggers.flatMap((trigger, i) =>\n\t\ttrigger.hasControlled ? [i] : [],\n\t);\n\tconst found = await stashedElementSelectors(adaptor, `${STASH_KEY}Controls`, withControls);\n\tconst controls: (string | null)[] = collection.triggers.map(() => null);\n\n\tfor (const [i, index] of withControls.entries()) {\n\t\tcontrols[index] = found[i]!;\n\t}\n\n\treturn { triggers: all.slice(0, count), controls, skipped: all.slice(count) };\n}\n\n/**\n * Find the page's disclosure triggers and operate each with Enter and Space, checking that it\n * opens, reports the change through `aria-expanded` and closes again.\n *\n * This activates controls on the page. Links that leave the page, buttons that submit a form,\n * checkboxes, radio buttons and controls named for an action that cannot be undone are never\n * activated; a key is only pressed while the trigger holds focus; and form submissions and\n * navigations to another document are stopped for as long as the audit runs. Every trigger is put\n * back as it was found where the page allows it, along with focus and scrolling.\n */\nexport async function runDisclosureOperabilityAudit(\n\tadaptor: BrowserAdaptor,\n\toptions: DisclosureOperabilityOptions = {},\n): Promise<DisclosureOperabilityResult> {\n\tconst triggerLimit = options.triggerLimit ?? DEFAULT_TRIGGER_LIMIT;\n\tconst timeout = options.activationTimeout ?? DEFAULT_ACTIVATION_TIMEOUT_MS;\n\tconst riskyNamePattern =\n\t\toptions.riskyNamePattern === undefined ? DEFAULT_RISKY_NAME_PATTERN : options.riskyNamePattern;\n\n\tif (riskyNamePattern !== null) {\n\t\t// Fail here, with the caller's pattern in the message, rather than inside the page.\n\t\tnew RegExp(riskyNamePattern, \"i\");\n\t}\n\n\t// A trigger that opens on focus only does so on a page that has focus.\n\tawait adaptor.ensureFocusReporting();\n\n\tconst collection = await adaptor.evaluate(\n\t\tinstallDisclosureScript,\n\t\tSTASH_KEY,\n\t\ttriggerLimit,\n\t\tSKIP_LIMIT,\n\t\tSCAN_LIMIT,\n\t\t{ includeControlsOnly: options.includeControlsOnly ?? false, riskyNamePattern },\n\t);\n\n\tlet stopped: \"navigated\" | null = null;\n\n\ttry {\n\t\t// Resolved before anything is pressed: a trigger may not survive being operated.\n\t\tconst selectors = await selectorsFor(adaptor, collection);\n\n\t\t// The page keeps its own references to the triggers, so the stashes can go now.\n\t\tawait releaseStashedElements(adaptor, STASH_KEY);\n\t\tawait releaseStashedElements(adaptor, `${STASH_KEY}Controls`);\n\n\t\tconst loop = await runDisclosureLoop(createAdaptorProbe(adaptor), collection.triggers, timeout);\n\n\t\tstopped = loop.stopped;\n\n\t\tconst failed: DisclosureTrigger[] = [];\n\t\tconst needsReview: DisclosureTrigger[] = [];\n\t\tconst passed: DisclosureTrigger[] = [];\n\n\t\tfor (const [index, { observation, keysTried }] of loop.exercised.entries()) {\n\t\t\tconst collected = collection.triggers[index]!;\n\t\t\tconst { verdict, signals } = classifyTrigger(observation);\n\t\t\tconst trigger: DisclosureTrigger = {\n\t\t\t\tselector: selectors.triggers[index]!,\n\t\t\t\thtml: truncateHtml(collected.html),\n\t\t\t\trole: collected.role,\n\t\t\t\texpanded: collected.expanded,\n\t\t\t\tcontrols: selectors.controls[index]!,\n\t\t\t\tsignals,\n\t\t\t\tkeysTried,\n\t\t\t\tattempts: [...observation.attempts],\n\t\t\t\tpointer: observation.pointer,\n\t\t\t\topenedOnFocus: observation.openedOnFocus !== null,\n\t\t\t\trestored: observation.restored && !observation.removed && !observation.navigated,\n\t\t\t};\n\n\t\t\t(verdict === \"failed\" ? failed : verdict === \"review\" ? needsReview : passed).push(trigger);\n\t\t}\n\n\t\tconst skipped: DisclosureSkipped[] = collection.skipped.map(({ html, reason }, i) => ({\n\t\t\tselector: selectors.skipped[i]!,\n\t\t\thtml: truncateHtml(html),\n\t\t\treason,\n\t\t}));\n\n\t\treturn {\n\t\t\tfailed,\n\t\t\tneedsReview,\n\t\t\tpassed,\n\t\t\tskipped,\n\t\t\tstopped,\n\t\t\tsummary: {\n\t\t\t\tchecked: loop.exercised.length,\n\t\t\t\tfailed: failed.length,\n\t\t\t\tneedsReview: needsReview.length,\n\t\t\t\tpassed: passed.length,\n\t\t\t\tskipped: collection.skippedTotal,\n\t\t\t\tunchecked: collection.eligible - loop.exercised.length,\n\t\t\t},\n\t\t};\n\t} finally {\n\t\t// Runs on every way out, an exception included: this is what lets forms submit and links\n\t\t// navigate again, and puts focus and scrolling back.\n\t\tif (stopped === null) {\n\t\t\ttry {\n\t\t\t\tawait adaptor.evaluate(callDisclosureScript, STASH_KEY, \"finish\");\n\t\t\t} catch {\n\t\t\t\t// The document went away after the last trigger: there is nothing left to tidy.\n\t\t\t}\n\t\t}\n\t}\n}\n","/** Why a trigger was found but left alone. */\nexport type DisclosureSkipReason =\n\t/** Not rendered, so no one can operate it as the page stands. */\n\t| \"hidden\"\n\t/** Disabled, `aria-disabled` or inside inert content. */\n\t| \"disabled\"\n\t/** A link that would leave the page, or a control inside one. */\n\t| \"navigating-link\"\n\t/** A submit or reset button, which would send or clear its form. */\n\t| \"submits-form\"\n\t/** A checkbox, radio button or switch: operating it changes a value, and Enter in a native one submits its form. */\n\t| \"checkable\"\n\t/** Its name suggests an action that cannot be undone, such as \"Delete account\" or \"Sign out\". */\n\t| \"risky-name\"\n\t/** A text field or combobox, which opens by typing or arrow keys, not Enter. */\n\t| \"text-entry\"\n\t/** A tree item, grid row or similar, which expands with arrow keys inside its widget. */\n\t| \"composite-item\"\n\t/** Not focusable itself but wraps something that is: the state sits on a container. */\n\t| \"state-on-container\";\n\n/** A trigger as it was found, before anything was pressed. */\nexport type CollectedTrigger = {\n\t/** `outerHTML`, cut to a sane length. Truncate to the opening tag on the host. */\n\thtml: string;\n\t/** The explicit `role`, or null. */\n\trole: string | null;\n\t/**\n\t * `aria-expanded` as written. Null only for a trigger that has `aria-controls` alone, which is\n\t * found when `includeControlsOnly` is set.\n\t */\n\texpanded: string | null;\n\t/** Whether an `aria-controls` id resolved to an element. */\n\thasControlled: boolean;\n\t/** Whether it can be reached with Tab (`tabIndex >= 0`). */\n\tinTabOrder: boolean;\n\t/** Whether it sits in a widget that moves focus with arrow keys (menu, toolbar, …). */\n\tinComposite: boolean;\n\t/** Whether Space must operate it: a `<button>` or `role=\"button\"`. */\n\tspaceExpected: boolean;\n\t/** Whether it is a native link, which Space does not activate. */\n\tlink: boolean;\n};\n\nexport type CollectedSkip = { html: string; reason: DisclosureSkipReason };\n\nexport type DisclosureCollection = {\n\t/** Triggers to exercise, in document order. `window[stashKey][i]` is the element. */\n\ttriggers: CollectedTrigger[];\n\t/** Triggers left alone, up to `skipLimit`. Their elements follow the triggers in the stash. */\n\tskipped: CollectedSkip[];\n\t/** Every trigger left alone, including those past `skipLimit`. */\n\tskippedTotal: number;\n\t/** Triggers that could have been exercised, including those past `triggerLimit`. */\n\teligible: number;\n};\n\n/** What a trigger and the page around it look like at one moment. */\nexport type DisclosureReading = {\n\t/** False once the trigger has left the document. */\n\tconnected: boolean;\n\t/** `aria-expanded` now. */\n\texpanded: string | null;\n\t/** Whether any `aria-controls` target is rendered, or null when none resolves. */\n\tcontrolled: boolean | null;\n\t/**\n\t * Elements outside the trigger that are rendered now and were not when the trigger was begun,\n\t * and the reverse. Null on a page too large to scan.\n\t */\n\tappeared: number | null;\n\tdisappeared: number | null;\n\t/** Whether the trigger has keyboard focus. */\n\tfocused: boolean;\n\t/**\n\t * Whether the trigger's content is still on the move: a transition or finite animation is\n\t * running on it, or its `aria-controls` target changed size since the last reading.\n\t */\n\tsettling: boolean;\n\t/** Clicks the browser itself delivered to the trigger since it was begun, as a key press does. */\n\tclicks: number;\n\t/** Form submissions and navigations to another document stopped since the trigger was begun. */\n\tblocked: { submits: number; navigations: number };\n};\n\n/** What the audit is about to do to a trigger. */\nexport type DisclosureAction = \"key\" | \"click\";\n\nexport type DisclosureInstallOptions = {\n\t/** Also treat a button with `aria-controls`, no `aria-expanded` and a hidden target as a trigger. */\n\tincludeControlsOnly?: boolean;\n\t/** Source of a case-insensitive pattern: a trigger whose name matches is not operated. */\n\triskyNamePattern?: string | null;\n};\n\nexport type DisclosureApi = {\n\tbegin(index: number): DisclosureReading;\n\tfocus(index: number): boolean;\n\tread(index: number): DisclosureReading;\n\t/**\n\t * Whether it is safe to act on the trigger now. A key needs the trigger to hold keyboard focus;\n\t * a click needs focus not to have moved elsewhere. Neither is safe behind a modal dialog.\n\t */\n\tready(index: number, action: DisclosureAction): boolean;\n\tblur(index: number): void;\n\tclick(index: number): void;\n\thover(index: number, on: boolean): void;\n\tend(index: number): void;\n\tfinish(): void;\n};\n\n/** The document the audit started on has gone: the page navigated. */\nexport type DisclosureGone = { gone: true };\n\n/**\n * Find the page's disclosure triggers, stash them on `window[stashKey]` (their first controlled\n * elements on `window[stashKey + \"Controls\"]`) and leave the functions the audit drives them with\n * on `window[stashKey + \"Api\"]`.\n *\n * A trigger is an element with `aria-expanded`. With `includeControlsOnly`, so is a button-like\n * element whose `aria-controls` names content that is not rendered. Native `<details>` and\n * `<select>` are not triggers.\n *\n * Until `finish` is called, form submissions and navigations to another document are stopped, so\n * that nothing a trigger does can send data or leave the page.\n */\nexport function installDisclosureScript(\n\tstashKey: string,\n\ttriggerLimit: number,\n\tskipLimit: number,\n\tscanLimit: number,\n\toptions: DisclosureInstallOptions = {},\n): DisclosureCollection {\n\tconst HTML_LIMIT = 2000;\n\tconst COMPOSITE = \"[role=menu],[role=menubar],[role=toolbar],[role=tablist],[role=listbox]\";\n\tconst COMPOSITE_ITEM = new Set([\n\t\t\"treeitem\",\n\t\t\"row\",\n\t\t\"gridcell\",\n\t\t\"columnheader\",\n\t\t\"rowheader\",\n\t\t\"option\",\n\t\t\"tab\",\n\t]);\n\tconst NOT_A_DISCLOSURE = new Set([\n\t\t\"tab\",\n\t\t\"combobox\",\n\t\t\"scrollbar\",\n\t\t\"slider\",\n\t\t\"spinbutton\",\n\t\t\"textbox\",\n\t\t\"searchbox\",\n\t\t\"radio\",\n\t\t\"checkbox\",\n\t\t\"switch\",\n\t\t\"option\",\n\t\t\"treeitem\",\n\t\t\"row\",\n\t\t\"gridcell\",\n\t]);\n\tconst CHECKABLE = new Set([\"checkbox\", \"radio\", \"switch\", \"menuitemcheckbox\", \"menuitemradio\"]);\n\tconst riskyName = options.riskyNamePattern ? new RegExp(options.riskyNamePattern, \"i\") : null;\n\tconst FOCUSABLE =\n\t\t\"a[href],button,input,select,textarea,summary,[tabindex],[contenteditable=''],[contenteditable=true]\";\n\n\tfunction everyElement(root: ParentNode, out: Element[]): Element[] {\n\t\tfor (const element of root.querySelectorAll(\"*\")) {\n\t\t\tout.push(element);\n\n\t\t\tif (element.shadowRoot) {\n\t\t\t\teveryElement(element.shadowRoot, out);\n\t\t\t}\n\t\t}\n\n\t\treturn out;\n\t}\n\n\t/**\n\t * Whether the element is on show to the user. With `anywhere`, an element parked outside the\n\t * document still counts: only whether it is rendered at all is asked.\n\t */\n\tfunction isShown(element: Element, anywhere = false): boolean {\n\t\tconst rect = element.getBoundingClientRect();\n\n\t\tif (rect.width <= 0 || rect.height <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Parked off the top or either side of the document, where no scrolling reaches it.\n\t\tconst pageWidth = Math.max(document.documentElement.scrollWidth, window.innerWidth);\n\n\t\tif (\n\t\t\t!anywhere &&\n\t\t\t(rect.right + window.scrollX <= 0 ||\n\t\t\t\trect.bottom + window.scrollY <= 0 ||\n\t\t\t\trect.left + window.scrollX >= pageWidth)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (typeof element.checkVisibility !== \"function\") {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn element.checkVisibility({\n\t\t\topacityProperty: true,\n\t\t\tvisibilityProperty: true,\n\t\t\t// The older names, for engines that shipped before the rename.\n\t\t\tcheckOpacity: true,\n\t\t\tcheckVisibilityCSS: true,\n\t\t});\n\t}\n\n\tfunction role(element: Element): string | null {\n\t\treturn element.getAttribute(\"role\")?.trim().toLowerCase() || null;\n\t}\n\n\tfunction controlled(element: Element): Element[] {\n\t\tconst root = element.getRootNode() as Document | ShadowRoot;\n\t\tconst found: Element[] = [];\n\n\t\tfor (const id of (element.getAttribute(\"aria-controls\") ?? \"\").split(/\\s+/)) {\n\t\t\tconst target =\n\t\t\t\tid && typeof root.getElementById === \"function\" ? root.getElementById(id) : null;\n\n\t\t\tif (target) {\n\t\t\t\tfound.push(target);\n\t\t\t}\n\t\t}\n\n\t\treturn found;\n\t}\n\n\tfunction navigates(element: Element): boolean {\n\t\tconst link = element.closest(\"a[href], area[href]\");\n\n\t\tif (!link) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst href = (link.getAttribute(\"href\") ?? \"\").trim();\n\n\t\treturn !(href === \"\" || href.startsWith(\"#\") || /^javascript:/i.test(href));\n\t}\n\n\tfunction submits(element: Element): boolean {\n\t\tif (element instanceof HTMLButtonElement) {\n\t\t\treturn element.form !== null && element.type !== \"button\";\n\t\t}\n\n\t\tif (element instanceof HTMLInputElement) {\n\t\t\treturn element.type === \"submit\" || element.type === \"image\" || element.type === \"reset\";\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/** A control that holds a value. Operating it changes the value, and Enter in a native one submits. */\n\tfunction isCheckable(element: Element): boolean {\n\t\tif (element instanceof HTMLInputElement) {\n\t\t\treturn element.type === \"checkbox\" || element.type === \"radio\";\n\t\t}\n\n\t\tconst elementRole = role(element);\n\n\t\treturn elementRole !== null && CHECKABLE.has(elementRole);\n\t}\n\n\t/** The trigger's name, near enough to match words in: labels first, then its own text. */\n\tfunction nameOf(element: Element): string {\n\t\tconst root = element.getRootNode() as Document | ShadowRoot;\n\t\tlet parts: string[] = [];\n\n\t\tfor (const id of (element.getAttribute(\"aria-labelledby\") ?? \"\").split(/\\s+/)) {\n\t\t\tconst label =\n\t\t\t\tid && typeof root.getElementById === \"function\" ? root.getElementById(id) : null;\n\n\t\t\tif (label) {\n\t\t\t\tparts.push(label.textContent ?? \"\");\n\t\t\t}\n\t\t}\n\n\t\tif (parts.join(\"\").trim() === \"\") {\n\t\t\tparts = [element.getAttribute(\"aria-label\") ?? \"\"];\n\t\t}\n\n\t\tif (parts.join(\"\").trim() === \"\") {\n\t\t\tparts = [element.textContent ?? \"\"];\n\n\t\t\tfor (const named of element.querySelectorAll(\"img[alt], [aria-label]\")) {\n\t\t\t\tparts.push(named.getAttribute(\"alt\") ?? named.getAttribute(\"aria-label\") ?? \"\");\n\t\t\t}\n\n\t\t\tif (element instanceof HTMLInputElement) {\n\t\t\t\tparts.push(element.value);\n\t\t\t}\n\n\t\t\tparts.push(element.getAttribute(\"title\") ?? \"\");\n\t\t}\n\n\t\treturn parts.join(\" \").replace(/\\s+/g, \" \").trim();\n\t}\n\n\tfunction isTextEntry(element: Element): boolean {\n\t\tif (role(element) === \"combobox\" || element instanceof HTMLTextAreaElement) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (element instanceof HTMLInputElement) {\n\t\t\treturn ![\"button\", \"checkbox\", \"radio\"].includes(element.type);\n\t\t}\n\n\t\treturn element instanceof HTMLElement && element.isContentEditable;\n\t}\n\n\tfunction isDisabled(element: Element): boolean {\n\t\treturn (\n\t\t\t(element as HTMLButtonElement).disabled === true ||\n\t\t\telement.getAttribute(\"aria-disabled\") === \"true\" ||\n\t\t\telement.closest(\"[inert]\") !== null ||\n\t\t\telement.closest(\"fieldset[disabled]\") !== null\n\t\t);\n\t}\n\n\tfunction isButtonLike(element: Element): boolean {\n\t\tconst tag = element.localName;\n\n\t\treturn (\n\t\t\ttag === \"button\" ||\n\t\t\trole(element) === \"button\" ||\n\t\t\trole(element) === \"menuitem\" ||\n\t\t\t(element instanceof HTMLInputElement && element.type === \"button\") ||\n\t\t\t(tag === \"a\" && !navigates(element)) ||\n\t\t\telement.hasAttribute(\"tabindex\")\n\t\t);\n\t}\n\n\t/** Whether `element` declares itself a disclosure trigger. */\n\tfunction isTrigger(element: Element): boolean {\n\t\tconst tag = element.localName;\n\n\t\tif (tag === \"details\" || tag === \"summary\" || tag === \"select\" || tag === \"option\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (element.hasAttribute(\"aria-expanded\")) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (!options.includeControlsOnly || !element.hasAttribute(\"aria-controls\")) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// With no expanded state, only a button whose target is not on show can be a disclosure.\n\t\t// A dialog's opener is not one: a dialog has no expanded state to report.\n\t\tconst elementRole = role(element);\n\t\tconst popup = element.getAttribute(\"aria-haspopup\");\n\n\t\tif (\n\t\t\t(elementRole !== null && NOT_A_DISCLOSURE.has(elementRole)) ||\n\t\t\tpopup === \"dialog\" ||\n\t\t\t!isButtonLike(element) ||\n\t\t\tisTextEntry(element)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst targets = controlled(element);\n\n\t\treturn targets.length > 0 && targets.every((target) => !isShown(target));\n\t}\n\n\tfunction skipReason(element: Element): DisclosureSkipReason | null {\n\t\tif (!isShown(element)) {\n\t\t\treturn \"hidden\";\n\t\t}\n\n\t\tif (isDisabled(element)) {\n\t\t\treturn \"disabled\";\n\t\t}\n\n\t\tif (isCheckable(element)) {\n\t\t\treturn \"checkable\";\n\t\t}\n\n\t\tif (isTextEntry(element)) {\n\t\t\treturn \"text-entry\";\n\t\t}\n\n\t\tconst elementRole = role(element);\n\n\t\tif (elementRole !== null && COMPOSITE_ITEM.has(elementRole)) {\n\t\t\treturn \"composite-item\";\n\t\t}\n\n\t\tif (navigates(element)) {\n\t\t\treturn \"navigating-link\";\n\t\t}\n\n\t\tif (submits(element)) {\n\t\t\treturn \"submits-form\";\n\t\t}\n\n\t\tif (riskyName?.test(nameOf(element))) {\n\t\t\treturn \"risky-name\";\n\t\t}\n\n\t\tconst focusable = element instanceof HTMLElement && element.tabIndex >= 0;\n\n\t\tif (!focusable && !element.hasAttribute(\"tabindex\") && element.querySelector(FOCUSABLE)) {\n\t\t\treturn \"state-on-container\";\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfunction html(element: Element): string {\n\t\treturn element.outerHTML.slice(0, HTML_LIMIT);\n\t}\n\n\tconst eligible: Element[] = [];\n\tconst skippedElements: Element[] = [];\n\tconst skipped: CollectedSkip[] = [];\n\tlet skippedTotal = 0;\n\n\tfor (const element of everyElement(document, [])) {\n\t\tif (!isTrigger(element)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst reason = skipReason(element);\n\n\t\tif (reason === null) {\n\t\t\teligible.push(element);\n\t\t\tcontinue;\n\t\t}\n\n\t\tskippedTotal++;\n\n\t\tif (skipped.length < skipLimit) {\n\t\t\tskipped.push({ html: html(element), reason });\n\t\t\tskippedElements.push(element);\n\t\t}\n\t}\n\n\t// Past the limit, take an even sample so a long page is covered from top to bottom.\n\tconst sampled =\n\t\teligible.length <= triggerLimit\n\t\t\t? eligible\n\t\t\t: Array.from(\n\t\t\t\t\t{ length: triggerLimit },\n\t\t\t\t\t(_, i) => eligible[Math.floor((i * eligible.length) / triggerLimit)]!,\n\t\t\t\t);\n\n\tconst store = window as unknown as Record<string, unknown>;\n\n\tstore[stashKey] = [...sampled, ...skippedElements];\n\tstore[`${stashKey}Controls`] = sampled.map((trigger) => controlled(trigger)[0] ?? null);\n\n\tfunction deepActiveElement(): Element | null {\n\t\tlet active = document.activeElement;\n\n\t\twhile (active?.shadowRoot?.activeElement) {\n\t\t\tactive = active.shadowRoot.activeElement;\n\t\t}\n\n\t\treturn active;\n\t}\n\n\tconst originalFocus = deepActiveElement();\n\tconst originalScroll = { x: window.scrollX, y: window.scrollY };\n\n\tlet baseline: Set<Element> | null = null;\n\tlet scroll = originalScroll;\n\tlet current: Element | null = null;\n\tlet focusAtBegin: Element | null = null;\n\tlet clicks = 0;\n\tlet geometry = \"\";\n\tconst blocked = { submits: 0, navigations: 0 };\n\n\t// Nothing a trigger does may send a form or leave the page while the audit is running.\n\tconst onSubmit = (event: Event): void => {\n\t\tevent.preventDefault();\n\t\tevent.stopImmediatePropagation();\n\t\tblocked.submits++;\n\t};\n\n\t// A click the browser delivers, as it does when Enter or Space activates a button.\n\tconst onClick = (event: Event): void => {\n\t\tif (event.isTrusted && current !== null && event.composedPath().includes(current)) {\n\t\t\tclicks++;\n\t\t}\n\t};\n\n\ttype NavigateEventLike = Event & {\n\t\thashChange?: boolean;\n\t\tdestination?: { sameDocument?: boolean };\n\t};\n\n\tconst onNavigate = (event: NavigateEventLike): void => {\n\t\t// Fragment and history-state changes stay in the document, so they are let through.\n\t\tif (event.hashChange || event.destination?.sameDocument || !event.cancelable) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tblocked.navigations++;\n\t};\n\n\tconst navigation = (window as unknown as { navigation?: EventTarget }).navigation;\n\tconst formPrototype = typeof HTMLFormElement === \"function\" ? HTMLFormElement.prototype : null;\n\tconst originalSubmit = formPrototype?.submit;\n\tconst originalRequestSubmit = formPrototype?.requestSubmit;\n\n\twindow.addEventListener(\"submit\", onSubmit, true);\n\twindow.addEventListener(\"click\", onClick, true);\n\tnavigation?.addEventListener(\"navigate\", onNavigate);\n\n\tif (formPrototype) {\n\t\tformPrototype.submit = function submit(): void {\n\t\t\tblocked.submits++;\n\t\t};\n\n\t\tif (originalRequestSubmit) {\n\t\t\tformPrototype.requestSubmit = function requestSubmit(): void {\n\t\t\t\tblocked.submits++;\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction unblock(): void {\n\t\twindow.removeEventListener(\"submit\", onSubmit, true);\n\t\twindow.removeEventListener(\"click\", onClick, true);\n\t\tnavigation?.removeEventListener(\"navigate\", onNavigate);\n\n\t\tif (formPrototype && originalSubmit) {\n\t\t\tformPrototype.submit = originalSubmit;\n\t\t}\n\n\t\tif (formPrototype && originalRequestSubmit) {\n\t\t\tformPrototype.requestSubmit = originalRequestSubmit;\n\t\t}\n\t}\n\n\t/** The boxes of the trigger's `aria-controls` targets, to tell when one is still changing size. */\n\tfunction geometryOf(targets: readonly Element[]): string {\n\t\treturn targets\n\t\t\t.map((target) => {\n\t\t\t\tconst rect = target.getBoundingClientRect();\n\n\t\t\t\treturn `${Math.round(rect.width)}x${Math.round(rect.height)}`;\n\t\t\t})\n\t\t\t.join(\",\");\n\t}\n\n\t/** Whether a transition or an animation that will end is running on the trigger's content. */\n\tfunction inMotion(trigger: Element, targets: readonly Element[]): boolean {\n\t\tif (typeof document.getAnimations !== \"function\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const animation of document.getAnimations()) {\n\t\t\tconst effect = animation.effect as KeyframeEffect | null;\n\t\t\tconst timing = effect?.getComputedTiming?.();\n\n\t\t\t// An endless animation, such as a spinner, never settles and is not waited for.\n\t\t\tif (\n\t\t\t\tanimation.playState !== \"running\" ||\n\t\t\t\t!timing ||\n\t\t\t\ttiming.iterations === Number.POSITIVE_INFINITY\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst target = effect?.target ?? null;\n\n\t\t\tif (\n\t\t\t\ttarget === null ||\n\t\t\t\ttargets.length === 0 ||\n\t\t\t\ttrigger.contains(target) ||\n\t\t\t\ttargets.some((controlled) => controlled.contains(target) || target.contains(controlled))\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/** A shown modal dialog that the trigger is not part of: whatever is pressed would land in it. */\n\tfunction behindModal(trigger: Element): boolean {\n\t\tfor (const modal of document.querySelectorAll(\"dialog[open], [aria-modal=true]\")) {\n\t\t\tif (modal.contains(trigger)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (modal.localName !== \"dialog\") {\n\t\t\t\tif (isShown(modal)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tif (modal.matches(\":modal\")) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// An engine without :modal: an open dialog is taken to be modeless.\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tfunction shownOutside(trigger: Element): Element[] | null {\n\t\tconst elements = everyElement(document.body ?? document, []);\n\n\t\tif (elements.length > scanLimit) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Across the whole page only being rendered counts, not where. A carousel or ticker moves\n\t\t// its slides in and out of the document for ever, and counting those as content that\n\t\t// appeared would put down to a key press what the page did by itself. Content that is moved\n\t\t// into view is still seen where `aria-controls` names it.\n\t\treturn elements.filter((element) => !trigger.contains(element) && isShown(element, true));\n\t}\n\n\tfunction read(index: number): DisclosureReading {\n\t\tconst trigger = sampled[index]!;\n\t\tconst targets = controlled(trigger);\n\t\tlet appeared: number | null = null;\n\t\tlet disappeared: number | null = null;\n\n\t\tif (baseline !== null) {\n\t\t\tconst now = shownOutside(trigger);\n\n\t\t\tif (now !== null) {\n\t\t\t\tconst seen = new Set(now);\n\n\t\t\t\tappeared = now.filter((element) => !baseline!.has(element)).length;\n\t\t\t\tdisappeared = [...baseline].filter((element) => !seen.has(element)).length;\n\t\t\t}\n\t\t}\n\n\t\tconst nowGeometry = geometryOf(targets);\n\t\tconst resized = nowGeometry !== geometry;\n\n\t\tgeometry = nowGeometry;\n\n\t\treturn {\n\t\t\tconnected: trigger.isConnected,\n\t\t\texpanded: trigger.getAttribute(\"aria-expanded\"),\n\t\t\tcontrolled: targets.length > 0 ? targets.some((target) => isShown(target)) : null,\n\t\t\tappeared,\n\t\t\tdisappeared,\n\t\t\tfocused: deepActiveElement() === trigger,\n\t\t\tsettling: resized || inMotion(trigger, targets),\n\t\t\tclicks,\n\t\t\tblocked: { ...blocked },\n\t\t};\n\t}\n\n\tfunction pointer(target: Element, types: readonly string[], bubbles: boolean): void {\n\t\tfor (const type of types) {\n\t\t\tconst init = { bubbles, cancelable: true, composed: true };\n\n\t\t\ttarget.dispatchEvent(\n\t\t\t\ttype.startsWith(\"pointer\") && typeof PointerEvent === \"function\"\n\t\t\t\t\t? new PointerEvent(type, init)\n\t\t\t\t\t: new MouseEvent(type, init),\n\t\t\t);\n\t\t}\n\t}\n\n\tconst api: DisclosureApi = {\n\t\tbegin(index) {\n\t\t\tconst trigger = sampled[index]!;\n\t\t\tconst shown = shownOutside(trigger);\n\n\t\t\tscroll = { x: window.scrollX, y: window.scrollY };\n\t\t\tbaseline = shown === null ? null : new Set(shown);\n\t\t\tcurrent = trigger;\n\t\t\tfocusAtBegin = deepActiveElement();\n\t\t\tclicks = 0;\n\t\t\tblocked.submits = 0;\n\t\t\tblocked.navigations = 0;\n\t\t\tgeometry = geometryOf(controlled(trigger));\n\n\t\t\treturn read(index);\n\t\t},\n\n\t\tfocus(index) {\n\t\t\tconst trigger = sampled[index]!;\n\n\t\t\tif (trigger instanceof HTMLElement || trigger instanceof SVGElement) {\n\t\t\t\ttrigger.focus({ preventScroll: true });\n\t\t\t}\n\n\t\t\treturn deepActiveElement() === trigger;\n\t\t},\n\n\t\tread,\n\n\t\tready(index, action) {\n\t\t\tconst trigger = sampled[index]!;\n\n\t\t\tif (!trigger.isConnected || trigger.closest(\"[inert]\") !== null || behindModal(trigger)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst active = deepActiveElement();\n\n\t\t\tif (action === \"key\") {\n\t\t\t\treturn active === trigger;\n\t\t\t}\n\n\t\t\t// A click is safe while focus is where the audit left it: on the trigger, or wherever it\n\t\t\t// was before a trigger that cannot take focus was begun.\n\t\t\treturn (\n\t\t\t\tactive === trigger || active === null || active === document.body || active === focusAtBegin\n\t\t\t);\n\t\t},\n\n\t\tblur(index) {\n\t\t\tconst trigger = sampled[index]!;\n\n\t\t\tif (trigger instanceof HTMLElement || trigger instanceof SVGElement) {\n\t\t\t\ttrigger.blur();\n\t\t\t}\n\t\t},\n\n\t\tclick(index) {\n\t\t\tconst trigger = sampled[index]!;\n\n\t\t\tif (trigger instanceof HTMLElement) {\n\t\t\t\ttrigger.click();\n\t\t\t} else {\n\t\t\t\tpointer(trigger, [\"click\"], true);\n\t\t\t}\n\t\t},\n\n\t\thover(index, on) {\n\t\t\tconst trigger = sampled[index]!;\n\n\t\t\tpointer(trigger, on ? [\"pointerover\", \"mouseover\"] : [\"pointerout\", \"mouseout\"], true);\n\n\t\t\t// Enter and leave events do not bubble: the browser fires one on each ancestor the pointer\n\t\t\t// crosses into, and a menu usually listens on the item around its trigger.\n\t\t\tfor (let target: Element | null = trigger; target; target = target.parentElement) {\n\t\t\t\tpointer(\n\t\t\t\t\ttarget,\n\t\t\t\t\ton ? [\"pointerenter\", \"mouseenter\"] : [\"pointerleave\", \"mouseleave\"],\n\t\t\t\t\tfalse,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\n\t\tend() {\n\t\t\tbaseline = null;\n\t\t\tcurrent = null;\n\t\t\twindow.scrollTo(scroll.x, scroll.y);\n\t\t},\n\n\t\tfinish() {\n\t\t\tconst active = deepActiveElement();\n\n\t\t\tif (\n\t\t\t\toriginalFocus?.isConnected &&\n\t\t\t\toriginalFocus !== document.body &&\n\t\t\t\t(originalFocus instanceof HTMLElement || originalFocus instanceof SVGElement)\n\t\t\t) {\n\t\t\t\toriginalFocus.focus({ preventScroll: true });\n\t\t\t} else if (active instanceof HTMLElement && active !== document.body) {\n\t\t\t\tactive.blur();\n\t\t\t}\n\n\t\t\twindow.scrollTo(originalScroll.x, originalScroll.y);\n\n\t\t\tunblock();\n\n\t\t\tdelete store[`${stashKey}Api`];\n\t\t},\n\t};\n\n\tstore[`${stashKey}Api`] = api;\n\n\treturn {\n\t\ttriggers: sampled.map((trigger) => ({\n\t\t\thtml: html(trigger),\n\t\t\trole: role(trigger),\n\t\t\texpanded: trigger.getAttribute(\"aria-expanded\"),\n\t\t\thasControlled: controlled(trigger).length > 0,\n\t\t\tinTabOrder: trigger instanceof HTMLElement && trigger.tabIndex >= 0,\n\t\t\tinComposite: trigger.closest(COMPOSITE) !== null,\n\t\t\tspaceExpected: trigger.localName === \"button\" || role(trigger) === \"button\",\n\t\t\tlink: trigger.localName === \"a\" && trigger.hasAttribute(\"href\"),\n\t\t})),\n\t\tskipped,\n\t\tskippedTotal,\n\t\teligible: eligible.length,\n\t};\n}\n\n/**\n * Call one of the functions installDisclosureScript left on the page. Answers `{ gone: true }` when\n * they are no longer there, which means the document was replaced.\n */\nexport function callDisclosureScript(\n\tstashKey: string,\n\tmethod: keyof DisclosureApi,\n\t...args: unknown[]\n): unknown {\n\tconst api = (window as unknown as Record<string, unknown>)[`${stashKey}Api`] as\n\t\t| Record<string, (...args: unknown[]) => unknown>\n\t\t| undefined;\n\n\tif (!api) {\n\t\treturn { gone: true } satisfies DisclosureGone;\n\t}\n\n\treturn api[method]!(...args) ?? null;\n}\n\n/** Whether the functions installDisclosureScript left on the page are still there. */\nexport function isDisclosureInstalledScript(stashKey: string): boolean {\n\treturn `${stashKey}Api` in window;\n}\n","export type DisclosureKey = \"Enter\" | \"Space\";\n\n/** What put a changed trigger back as it was found. */\nexport type DisclosureRestore = DisclosureKey | \"Escape\" | \"click\" | \"blur\";\n\nexport type DisclosureAttempt = {\n\tkey: DisclosureKey;\n\t/** `aria-expanded` before and after the key press. */\n\texpandedBefore: string | null;\n\texpandedAfter: string | null;\n\t/** Whether content was shown or hidden: an `aria-controls` target, or anything else on the page. */\n\tcontentChanged: boolean;\n\t/** What undid the change, or null when nothing changed or nothing undid it. */\n\trestoredBy: DisclosureRestore | null;\n};\n\nexport type DisclosureSignal =\n\t/** Fails: it works with a pointer but cannot take keyboard focus (WCAG 2.1.1). */\n\t| \"not-focusable\"\n\t/** Fails: it works with a pointer but neither Enter nor Space does anything (WCAG 2.1.1). */\n\t| \"keyboard-inoperable\"\n\t/** Fails: a key shows or hides content but `aria-expanded` is missing or never changes (WCAG 4.1.2). */\n\t| \"state-not-exposed\"\n\t/** Review: nothing the audit tried, keyboard or pointer, changed anything. */\n\t| \"unresponsive\"\n\t/** Review: `aria-expanded` changes but no content was seen to appear or disappear. */\n\t| \"state-without-content\"\n\t/** Review: Enter works but Space does not, on a button. */\n\t| \"space-inoperable\"\n\t/** Review: Space works but Enter does not. */\n\t| \"enter-inoperable\"\n\t/** Review: it opens with a key but only a click closes it again. */\n\t| \"pointer-only-close\"\n\t/**\n\t * Review: once opened, nothing the audit could safely try closed it. The page was left changed.\n\t * What opened may have kept focus to itself, in which case only Escape was pressed.\n\t */\n\t| \"not-restored\"\n\t/** Review: operating it tried to submit a form, which the audit stopped. */\n\t| \"submit-blocked\"\n\t/** Review: operating it tried to load another page, which the audit stopped. */\n\t| \"navigation-blocked\"\n\t/** Review: content appears when the trigger takes focus, without `aria-expanded` changing. */\n\t| \"opens-on-focus\"\n\t/** Review: the trigger left the document when operated. */\n\t| \"trigger-removed\"\n\t/** Review: it has a negative `tabindex` and is not part of a widget that manages focus. */\n\t| \"not-in-tab-order\"\n\t/** Review: operating it replaced the document, and the audit stopped. */\n\t| \"navigated\";\n\nexport type Verdict = \"failed\" | \"review\" | null;\n\nexport type DisclosureObservation = {\n\t/** Whether the trigger took focus. */\n\tfocusable: boolean;\n\tinTabOrder: boolean;\n\tinComposite: boolean;\n\tspaceExpected: boolean;\n\t/** Set when taking focus alone changed the trigger or the page. */\n\topenedOnFocus: { expandedChanged: boolean } | null;\n\tattempts: readonly DisclosureAttempt[];\n\t/** Whether a click or a hover changed anything. Null when not tried. */\n\tpointer: { click: boolean | null; hover: boolean | null };\n\t/** Whether operating it tried to submit a form or leave the page, and was stopped. */\n\tblocked: { submit: boolean; navigation: boolean };\n\tremoved: boolean;\n\tnavigated: boolean;\n\t/** False when the trigger could not be put back as it was found. */\n\trestored: boolean;\n};\n\nexport type DisclosureClassification = { verdict: Verdict; signals: DisclosureSignal[] };\n\nconst FAILING: ReadonlySet<DisclosureSignal> = new Set([\n\t\"not-focusable\",\n\t\"keyboard-inoperable\",\n\t\"state-not-exposed\",\n]);\n\nfunction expandedChanged(attempt: DisclosureAttempt): boolean {\n\treturn attempt.expandedBefore !== attempt.expandedAfter;\n}\n\nfunction changed(attempt: DisclosureAttempt): boolean {\n\treturn expandedChanged(attempt) || attempt.contentChanged;\n}\n\n/** Decide what the keys pressed on one trigger, and what they changed, say about it. */\nexport function classifyTrigger(observation: DisclosureObservation): DisclosureClassification {\n\tconst signals: DisclosureSignal[] = [];\n\tconst respondsToPointer =\n\t\tobservation.pointer.click === true || observation.pointer.hover === true;\n\tconst working = observation.attempts.filter(changed);\n\t// A control that tried to send a form or leave the page did respond, just not as a disclosure.\n\tconst blocked = observation.blocked.submit || observation.blocked.navigation;\n\n\tif (observation.navigated) {\n\t\tsignals.push(\"navigated\");\n\t} else if (observation.removed) {\n\t\tsignals.push(\"trigger-removed\");\n\t} else if (!observation.focusable) {\n\t\tif (respondsToPointer) {\n\t\t\tsignals.push(\"not-focusable\");\n\t\t} else if (!blocked) {\n\t\t\tsignals.push(\"unresponsive\");\n\t\t}\n\t} else if (observation.openedOnFocus) {\n\t\tif (!observation.openedOnFocus.expandedChanged) {\n\t\t\tsignals.push(\"opens-on-focus\");\n\t\t}\n\t} else if (working.length === 0) {\n\t\tif (respondsToPointer) {\n\t\t\tsignals.push(\"keyboard-inoperable\");\n\t\t} else if (!blocked) {\n\t\t\tsignals.push(\"unresponsive\");\n\t\t}\n\t} else {\n\t\tif (working.some((attempt) => attempt.contentChanged && !expandedChanged(attempt))) {\n\t\t\tsignals.push(\"state-not-exposed\");\n\t\t}\n\n\t\tif (working.every((attempt) => !attempt.contentChanged)) {\n\t\t\tsignals.push(\"state-without-content\");\n\t\t}\n\n\t\tconst works = (key: DisclosureAttempt[\"key\"]) => working.some((attempt) => attempt.key === key);\n\t\tconst tried = (key: DisclosureAttempt[\"key\"]) =>\n\t\t\tobservation.attempts.some((attempt) => attempt.key === key);\n\n\t\tif (works(\"Enter\") && tried(\"Space\") && !works(\"Space\") && observation.spaceExpected) {\n\t\t\tsignals.push(\"space-inoperable\");\n\t\t}\n\n\t\tif (works(\"Space\") && tried(\"Enter\") && !works(\"Enter\")) {\n\t\t\tsignals.push(\"enter-inoperable\");\n\t\t}\n\n\t\tif (working.some((attempt) => attempt.restoredBy === \"click\")) {\n\t\t\tsignals.push(\"pointer-only-close\");\n\t\t}\n\t}\n\n\tif (!observation.restored && !observation.navigated && !observation.removed) {\n\t\tsignals.push(\"not-restored\");\n\t}\n\n\tif (observation.blocked.submit && !observation.navigated) {\n\t\tsignals.push(\"submit-blocked\");\n\t}\n\n\tif (observation.blocked.navigation && !observation.navigated) {\n\t\tsignals.push(\"navigation-blocked\");\n\t}\n\n\tif (\n\t\tobservation.focusable &&\n\t\t!observation.inTabOrder &&\n\t\t!observation.inComposite &&\n\t\t!observation.navigated\n\t) {\n\t\tsignals.push(\"not-in-tab-order\");\n\t}\n\n\tconst verdict: Verdict = signals.some((signal) => FAILING.has(signal))\n\t\t? \"failed\"\n\t\t: signals.length > 0\n\t\t\t? \"review\"\n\t\t\t: null;\n\n\t// Most serious first.\n\tsignals.sort((a, b) => Number(FAILING.has(b)) - Number(FAILING.has(a)));\n\n\treturn { verdict, signals };\n}\n"],"mappings":";AAAA;AAAA,EAEC;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;;;ACwHtB,SAAS,wBACf,UACA,cACA,WACA,WACA,UAAoC,CAAC,GACd;AACvB,QAAM,aAAa;AACnB,QAAM,YAAY;AAClB,QAAM,iBAAiB,oBAAI,IAAI;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AACD,QAAM,mBAAmB,oBAAI,IAAI;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAC;AACD,QAAM,YAAY,oBAAI,IAAI,CAAC,YAAY,SAAS,UAAU,oBAAoB,eAAe,CAAC;AAC9F,QAAM,YAAY,QAAQ,mBAAmB,IAAI,OAAO,QAAQ,kBAAkB,GAAG,IAAI;AACzF,QAAM,YACL;AAED,WAAS,aAAa,MAAkB,KAA2B;AAClE,eAAW,WAAW,KAAK,iBAAiB,GAAG,GAAG;AACjD,UAAI,KAAK,OAAO;AAEhB,UAAI,QAAQ,YAAY;AACvB,qBAAa,QAAQ,YAAY,GAAG;AAAA,MACrC;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AAMA,WAAS,QAAQ,SAAkB,WAAW,OAAgB;AAC7D,UAAM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AAW;AAAA,QACpB,WAAW,WAAW,WAAW,KAAK,UAAU;AAAA,MACjD;AAAA,IACD;AAAA,EACD,UAAE;AAGD,QAAI,YAAY,MAAM;AACrB,UAAI;AACH,cAAM,QAAQ,SAAS,sBAAsB,WAAW,QAAQ;AAAA,MACjE,QAAQ;AAAA,MAER;AAAA,IACD;AAAA,EACD;AACD;","names":["controlled"]}
@@ -0,0 +1,65 @@
1
+ import type { DisclosureSkipReason } from "./browser-scripts";
2
+ import type { DisclosureAttempt, DisclosureKey, DisclosureSignal } from "./classify";
3
+ export type DisclosureTrigger = {
4
+ /** Selector for the trigger (see getSelector). */
5
+ selector: string;
6
+ /** Truncated opening tag. */
7
+ html: string;
8
+ /** The explicit `role`, or null. */
9
+ role: string | null;
10
+ /**
11
+ * `aria-expanded` as the trigger was found. Null only for a trigger with `aria-controls` alone,
12
+ * which is operated when `includeControlsOnly` is set.
13
+ */
14
+ expanded: string | null;
15
+ /** Selector for the first element its `aria-controls` names, or null when none resolves. */
16
+ controls: string | null;
17
+ /** Every signal that applies, most serious first. Empty when the trigger passes. */
18
+ signals: DisclosureSignal[];
19
+ /** The keys pressed on it, in order. */
20
+ keysTried: DisclosureKey[];
21
+ /** What each key press changed, and what undid it. */
22
+ attempts: DisclosureAttempt[];
23
+ /**
24
+ * Whether a click or hover changed anything. Only tried when no key did, so null otherwise.
25
+ * `click` is false without a scripted click when a key already clicked the trigger to no effect.
26
+ */
27
+ pointer: {
28
+ click: boolean | null;
29
+ hover: boolean | null;
30
+ };
31
+ /** Whether taking keyboard focus alone opened it. */
32
+ openedOnFocus: boolean;
33
+ /** Whether it was left as it was found. */
34
+ restored: boolean;
35
+ };
36
+ export type DisclosureSkipped = {
37
+ selector: string;
38
+ html: string;
39
+ reason: DisclosureSkipReason;
40
+ };
41
+ export type DisclosureOperabilityResult = {
42
+ /** Triggers that a pointer operates and the keyboard does not, or that hide their state. */
43
+ failed: DisclosureTrigger[];
44
+ /** Triggers a human should check. */
45
+ needsReview: DisclosureTrigger[];
46
+ passed: DisclosureTrigger[];
47
+ /** Triggers found but deliberately not operated, up to ten. */
48
+ skipped: DisclosureSkipped[];
49
+ /**
50
+ * Set when the audit stopped early: operating a trigger replaced the document. The triggers
51
+ * after it were not checked and the page is no longer the one the audit started on.
52
+ */
53
+ stopped: "navigated" | null;
54
+ summary: {
55
+ /** Triggers operated. Zero means inapplicable. */
56
+ checked: number;
57
+ failed: number;
58
+ needsReview: number;
59
+ passed: number;
60
+ /** Every trigger found but not operated, including those past the ten listed. */
61
+ skipped: number;
62
+ /** Operable triggers left out by `triggerLimit`, or not reached before the audit stopped. */
63
+ unchecked: number;
64
+ };
65
+ };
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
- "name": "@a11y-pulse/disclosure-operability-audit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@a11y-pulse/disclosure-operability-audit",
3
+ "version": "0.1.0",
4
+ "description": "WCAG 2.1.1 Keyboard and 4.1.2 Name, Role, Value audit that operates disclosure triggers (aria-expanded) with Enter and Space and checks that they open, close and report their state.",
5
+ "type": "module",
6
+ "license": "SEE LICENSE IN LICENSE.md",
7
+ "author": "A11y Pulse",
8
+ "homepage": "https://github.com/A11y-Pulse/audits/tree/main/packages/disclosure-operability-audit#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/A11y-Pulse/audits.git",
12
+ "directory": "packages/disclosure-operability-audit"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/A11y-Pulse/audits/issues"
16
+ },
17
+ "keywords": [
18
+ "accessibility",
19
+ "a11y",
20
+ "wcag",
21
+ "keyboard",
22
+ "aria-expanded",
23
+ "disclosure",
24
+ "audit"
25
+ ],
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "source": "./src/index.ts",
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "README.md",
39
+ "LICENSE.md"
40
+ ],
41
+ "scripts": {
42
+ "build": "tsup && tsc -p tsconfig.build.json",
43
+ "typecheck": "tsc --noEmit",
44
+ "lint": "biome check",
45
+ "lint:fix": "biome check --fix",
46
+ "test:unit": "vitest run",
47
+ "test:integration": "vitest run --config vitest.integration.config.ts",
48
+ "test": "npm run typecheck && npm run test:unit",
49
+ "prepublishOnly": "npm run build"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "dependencies": {
55
+ "@a11y-pulse/browser-adaptor": "*"
56
+ },
57
+ "devDependencies": {
58
+ "happy-dom": "^21.0.4",
59
+ "playwright-core": "^1.65.0",
60
+ "puppeteer": "^25.16.0"
61
+ }
62
+ }