@a11y-pulse/moving-content-audit 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +166 -0
- package/README.md +221 -2
- package/dist/audit.d.ts +57 -0
- package/dist/browser-scripts.d.ts +113 -0
- package/dist/classify.d.ts +54 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1076 -0
- package/dist/index.js.map +1 -0
- package/dist/result.d.ts +94 -0
- package/package.json +60 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audit.ts","../src/browser-scripts.ts","../src/classify.ts"],"sourcesContent":["import {\n\ttype BrowserAdaptor,\n\tcaptureElementScreenshot,\n\treleaseStashedElements,\n\tstashedElementHandle,\n\tstashedElementSelectors,\n} from \"@a11y-pulse/browser-adaptor\";\nimport { truncateHtml } from \"@a11y-pulse/browser-adaptor/dom\";\nimport {\n\ttype CollectedRegion,\n\ttype CollectOptions,\n\tcollectRegionsScript,\n\trestoreScrollScript,\n\tscrollPositionScript,\n\tstartObservationScript,\n\tstopObservationScript,\n} from \"./browser-scripts\";\nimport { type Classification, classifyRegion, QUIET_GAP_FRACTION, type Verdict } from \"./classify\";\nimport type { MovingContentRegion, MovingContentResult } from \"./result\";\n\n/** WCAG 2.2.2 allows movement that stops within five seconds. */\nexport const DURATION_LIMIT_MS = 5000;\n\nexport const DEFAULT_OBSERVATION_WINDOW = DURATION_LIMIT_MS;\nexport const DEFAULT_MIN_REGION_AREA = 5000;\nexport const DEFAULT_LARGE_REGION_AREA = 20_000;\nexport const DEFAULT_REGION_LIMIT = 20;\nexport const DEFAULT_SCREENSHOT_LIMIT = 5;\nexport const DEFAULT_SCREENSHOT_INTERVAL = 1000;\n\n/**\n * Labels of a control that pauses, stops or hides moving content. \"Play\" only counts as the whole\n * label, paired with \"pause\", or followed by what is moving (\"Play slideshow\"): \"Play trailer\"\n * starts something else.\n */\nexport const DEFAULT_CONTROL_NAME_PATTERN =\n\t\"(^|[^\\\\p{L}])(pause|paused|unpause|stop|halt|freeze|hide|close|dismiss|pausar|pausa|detener|parar|pausieren|anhalten|stopp|stoppen|arrêter|pauzeren|fermare|pausera|stoppa|play\\\\s*(/|\\\\||&|and|or)\\\\s*pause|play(ing)?\\\\s+(the\\\\s+)?(slideshow|slide\\\\s?show|slides|carousel|animations?|rotation|ticker|marquee|background\\\\s+video))($|[^\\\\p{L}])|^\\\\s*(play|playing)\\\\s*$\";\n\nconst CONTROL_ATTRIBUTE_PATTERN = \"(^|[-_\\\\s])(pause|playpause|play-pause|stop)($|[-_\\\\s])\";\n\n// A verb, then at most two words, then what it acts on: \"Turn off animations\", \"Pause all motion\".\n// The words are separate, so a link to a \"Stop-motion season\" is not a switch.\nconst PAGE_CONTROL_PATTERN =\n\t\"\\\\b(pause|stop|turn off|disable|reduce)\\\\s+(\\\\S+\\\\s+){0,2}(animations?|motion|movement|moving|autoplay)\\\\b\";\n\nconst ESSENTIAL_PATTERN =\n\t\"(^|[-_\\\\s])(spinner|loader|loading|skeleton|shimmer|progress)($|[-_\\\\s])\";\n\nconst STATE_KEY = \"__a11yPulseMovingContentState\";\nconst STASH_KEY = \"__a11yPulseMovingContent\";\n\nconst SCREENSHOT_CLIP_BUFFER = 10;\nconst SCREENSHOT_SETTLE_MS = 33; // ~2 frames at 60fps\n\n// How many times the page is sampled over the window, and the fastest and slowest it is sampled.\nconst POLLS_PER_WINDOW = 50;\nconst MIN_POLL_MS = 20;\nconst MAX_POLL_MS = 250;\n\n// Elements a script touches during the window are watched for movement, up to this many at a\n// time. Ones that have settled make room for new ones.\nconst TRACK_LIMIT = 150;\n\n// A pause between changes has to outlast this many samples to count as one.\nconst QUIET_GAP_POLLS = 3;\n\nexport type MovingContentOptions = {\n\t/**\n\t * How long to watch the page for, in ms. Content still moving at the end is reported. Defaults\n\t * to 5000, the limit in WCAG 2.2.2; the audit takes at least this long.\n\t */\n\tobservationWindow?: number;\n\t/** Smallest visible area, in CSS px², of a moving region worth reporting. Defaults to 5000. */\n\tminRegionArea?: number;\n\t/**\n\t * Smallest visible area, in CSS px², of a region that can fail. Smaller regions are reported\n\t * for review. Defaults to 20000.\n\t */\n\tlargeRegionArea?: number;\n\t/** Max moving regions to examine, largest first. Defaults to 20. */\n\tregionLimit?: number;\n\t/**\n\t * Regular expression source, matched case-insensitively against the label of controls near a\n\t * moving region to find one that pauses, stops or hides it.\n\t */\n\tcontrolNamePattern?: string;\n\t/**\n\t * Max failed and needs-review regions to screenshot, failed first. Each gets two captures,\n\t * `screenshotInterval` apart. Defaults to 5; 0 takes none.\n\t */\n\tscreenshotLimit?: number;\n\t/** Time between a region's two screenshots, in ms. Defaults to 1000. */\n\tscreenshotInterval?: number;\n};\n\n/** How often, in ms, the page is sampled over an observation window of `observationWindow` ms. */\nexport function pollInterval(observationWindow: number): number {\n\treturn Math.min(\n\t\tMAX_POLL_MS,\n\t\tMath.max(MIN_POLL_MS, Math.round(observationWindow / POLLS_PER_WINDOW)),\n\t);\n}\n\n/**\n * How long, in ms, an element has to hold still for its next change to count as a separate burst\n * of movement.\n */\nexport function quietGap(observationWindow: number): number {\n\treturn Math.max(\n\t\tMath.round(observationWindow * QUIET_GAP_FRACTION),\n\t\tpollInterval(observationWindow) * QUIET_GAP_POLLS,\n\t);\n}\n\ntype Classified = { region: CollectedRegion; classification: Classification };\n\nfunction sleep(ms: number): Promise<void> {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function screenshotRegion(adaptor: BrowserAdaptor, index: number): Promise<Uint8Array> {\n\tconst handle = await stashedElementHandle(adaptor, STASH_KEY, index);\n\n\ttry {\n\t\treturn await captureElementScreenshot(adaptor, handle, {\n\t\t\tclipBuffer: SCREENSHOT_CLIP_BUFFER,\n\t\t\tsettleDelay: SCREENSHOT_SETTLE_MS,\n\t\t});\n\t} finally {\n\t\tawait adaptor.disposeRef(handle);\n\t}\n}\n\nasync function toRegions(\n\tadaptor: BrowserAdaptor,\n\tclassified: readonly Classified[],\n): Promise<MovingContentRegion[]> {\n\tconst selectors = await stashedElementSelectors(\n\t\tadaptor,\n\t\tSTASH_KEY,\n\t\tclassified.map(({ region }) => region.elementIndex),\n\t);\n\tconst controls = classified.flatMap(({ region }) => (region.control ? [region.control] : []));\n\tconst controlSelectors = await stashedElementSelectors(\n\t\tadaptor,\n\t\tSTASH_KEY,\n\t\tcontrols.map((control) => control.elementIndex),\n\t);\n\n\treturn classified.map(({ region, classification }, i) => {\n\t\tconst control = region.control;\n\n\t\treturn {\n\t\t\tselector: selectors[i]!,\n\t\t\thtml: truncateHtml(region.html),\n\t\t\trect: region.rect,\n\t\t\tmotion: classification.motion,\n\t\t\tdetectedBy: classification.detectedBy,\n\t\t\tfinding: classification.finding,\n\t\t\tobservedMs: classification.observedMs,\n\t\t\tanimations: region.animations.map(\n\t\t\t\t({ name, infinite, activeDurationMs, properties, pseudoElement }) => ({\n\t\t\t\t\tname,\n\t\t\t\t\tinfinite,\n\t\t\t\t\tactiveDurationMs,\n\t\t\t\t\tproperties,\n\t\t\t\t\tpseudoElement,\n\t\t\t\t}),\n\t\t\t),\n\t\t\tpauseControl: control\n\t\t\t\t? {\n\t\t\t\t\t\tselector: controlSelectors[controls.indexOf(control)]!,\n\t\t\t\t\t\thtml: truncateHtml(control.html),\n\t\t\t\t\t\tname: control.name,\n\t\t\t\t\t\tfoundBy: control.foundBy,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tpausesOn: region.pausesOn,\n\t\t\treducedMotion: region.reducedMotion,\n\t\t};\n\t});\n}\n\n/**\n * Watch the page for content that keeps moving on its own and look for a way to pause it. Nothing\n * is pressed or hovered, and the page is left as it was found. Takes `observationWindow` ms, 5\n * seconds by default, plus the time for screenshots.\n */\nexport async function runMovingContentAudit(\n\tadaptor: BrowserAdaptor,\n\toptions: MovingContentOptions = {},\n): Promise<MovingContentResult> {\n\tconst observationWindow = options.observationWindow ?? DEFAULT_OBSERVATION_WINDOW;\n\tconst screenshotLimit = options.screenshotLimit ?? DEFAULT_SCREENSHOT_LIMIT;\n\tconst screenshotInterval = options.screenshotInterval ?? DEFAULT_SCREENSHOT_INTERVAL;\n\tconst pollMs = pollInterval(observationWindow);\n\tconst quietGapMs = quietGap(observationWindow);\n\tconst collectOptions: CollectOptions = {\n\t\tdurationLimitMs: DURATION_LIMIT_MS,\n\t\tminRegionArea: options.minRegionArea ?? DEFAULT_MIN_REGION_AREA,\n\t\tregionLimit: options.regionLimit ?? DEFAULT_REGION_LIMIT,\n\t\tcontrolNamePattern: options.controlNamePattern ?? DEFAULT_CONTROL_NAME_PATTERN,\n\t\tcontrolAttributePattern: CONTROL_ATTRIBUTE_PATTERN,\n\t\tpageControlPattern: PAGE_CONTROL_PATTERN,\n\t\tessentialPattern: ESSENTIAL_PATTERN,\n\t};\n\n\tawait adaptor.evaluate(\n\t\tstartObservationScript,\n\t\tSTATE_KEY,\n\t\tpollMs,\n\t\tDURATION_LIMIT_MS,\n\t\tTRACK_LIMIT,\n\t\tquietGapMs,\n\t);\n\n\ttry {\n\t\tawait sleep(observationWindow);\n\n\t\tconst collection = await adaptor.evaluate(\n\t\t\tcollectRegionsScript,\n\t\t\tSTATE_KEY,\n\t\t\tSTASH_KEY,\n\t\t\tcollectOptions,\n\t\t);\n\n\t\tconst classified = collection.regions.flatMap((region): Classified[] => {\n\t\t\tconst classification = classifyRegion(region, {\n\t\t\t\tobservedMs: collection.elapsedMs,\n\t\t\t\tdurationLimitMs: DURATION_LIMIT_MS,\n\t\t\t\tlargeRegionArea: options.largeRegionArea ?? DEFAULT_LARGE_REGION_AREA,\n\t\t\t});\n\n\t\t\treturn classification ? [{ region, classification }] : [];\n\t\t});\n\t\tconst withVerdict = (verdict: Verdict): Classified[] =>\n\t\t\tclassified.filter(({ classification }) => classification.verdict === verdict);\n\n\t\tconst failed = await toRegions(adaptor, withVerdict(\"failed\"));\n\t\tconst needsReview = await toRegions(adaptor, withVerdict(\"needsReview\"));\n\t\tconst passed = await toRegions(adaptor, withVerdict(\"passed\"));\n\n\t\tconst toScreenshot = [...withVerdict(\"failed\"), ...withVerdict(\"needsReview\")].slice(\n\t\t\t0,\n\t\t\tscreenshotLimit,\n\t\t);\n\n\t\tif (toScreenshot.length > 0) {\n\t\t\tconst reported = [...failed, ...needsReview];\n\t\t\t// Screenshots scroll regions into view; put the page back where it was afterwards.\n\t\t\tconst scroll = await adaptor.evaluate(scrollPositionScript);\n\n\t\t\ttry {\n\t\t\t\tfor (const [i, { region }] of toScreenshot.entries()) {\n\t\t\t\t\treported[i]!.screenshot = await screenshotRegion(adaptor, region.elementIndex);\n\t\t\t\t}\n\n\t\t\t\tawait sleep(screenshotInterval);\n\n\t\t\t\tfor (const [i, { region }] of toScreenshot.entries()) {\n\t\t\t\t\treported[i]!.laterScreenshot = await screenshotRegion(adaptor, region.elementIndex);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tawait adaptor.evaluate(restoreScrollScript, scroll);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tfailed,\n\t\t\tneedsReview,\n\t\t\tpassed,\n\t\t\tobservedMs: collection.elapsedMs,\n\t\t\tsummary: {\n\t\t\t\tchecked: classified.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\tunchecked: collection.total - collection.regions.length,\n\t\t\t\tignored: { essential: collection.essential, tooSmall: collection.tooSmall },\n\t\t\t},\n\t\t};\n\t} finally {\n\t\tawait adaptor.evaluate(stopObservationScript, STATE_KEY);\n\t\tawait releaseStashedElements(adaptor, STASH_KEY);\n\t}\n}\n","/**\n * IMPORTANT: The `*Script` functions in this file are serialized and injected into the audited\n * page, so they must not reference any symbols outside their own scope.\n */\n\nimport type { Rect } from \"@a11y-pulse/browser-adaptor\";\n\nexport type CollectedAnimation = {\n\tname: string | null;\n\t/** A CSS animation, as opposed to one a script started through the Web Animations API. */\n\tcss: boolean;\n\tinfinite: boolean;\n\tactiveDurationMs: number | null;\n\t/** Properties whose value changes over the animation. Empty when they could not be read. */\n\tproperties: string[];\n\t/** The pseudo-element the animation runs on, such as `::after`. Null for the element itself. */\n\tpseudoElement: string | null;\n\t/** The pseudo-element's own area in CSS px², or null when its size could not be read. */\n\tpseudoArea: number | null;\n};\n\nexport type CollectedVideo = {\n\tcontrols: boolean;\n\t/** The video loops, or is a live stream with no end. */\n\tendless: boolean;\n\t/** Null for a live stream or a video whose length is not known yet. */\n\tdurationS: number | null;\n\t/** The video was already playing when observation started. */\n\tplayingAtStart: boolean;\n\t/** Its playback position moved during observation. */\n\tadvanced: boolean;\n};\n\nexport type CollectedControl = {\n\t/** Index of the control in the stash. */\n\telementIndex: number;\n\thtml: string;\n\tname: string;\n\tfoundBy: \"name\" | \"attribute\" | \"page-control\";\n};\n\nexport type CollectedRegion = {\n\t/** Index of the region's element in the stash. */\n\telementIndex: number;\n\t/** Shallow outerHTML. */\n\thtml: string;\n\t/** The visible part of the region, in document coordinates. */\n\trect: Rect;\n\t/**\n\t * When, in ms since observation started, an element in the region was seen to change position,\n\t * size, visibility or scroll offset, or a short animation was seen to start on it. The changes\n\t * that first brought an element into view are left out.\n\t */\n\ttimes: number[];\n\t/** Every element seen changing only came into view, or was only inserted, during the watch. */\n\tappeared: boolean;\n\t/** Animations still running that last longer than the limit. */\n\tanimations: CollectedAnimation[];\n\t/** Set for a `<marquee>`: its `loop` count, -1 for endless. */\n\tmarquee: { loop: number } | null;\n\tvideo: CollectedVideo | null;\n\tcontrol: CollectedControl | null;\n\tpausesOn: (\"hover\" | \"focus\")[];\n\treducedMotion: boolean | null;\n};\n\nexport type RegionCollection = {\n\t/** How long the page was observed for. */\n\telapsedMs: number;\n\tregions: CollectedRegion[];\n\t/** Every moving region, including those past the region limit. */\n\ttotal: number;\n\t/** Moving regions under the size threshold. */\n\ttooSmall: number;\n\t/** Moving progress indicators, status messages and busy regions. */\n\tessential: number;\n};\n\nexport type CollectOptions = {\n\t/** Animations no longer than this are allowed to run to their end. */\n\tdurationLimitMs: number;\n\tminRegionArea: number;\n\tregionLimit: number;\n\t/** Regular expression source matched against a nearby control's label. */\n\tcontrolNamePattern: string;\n\t/** Regular expression source matched against an unlabelled nearby control's class and id. */\n\tcontrolAttributePattern: string;\n\t/** Regular expression source matched against the label of any control on the page. */\n\tpageControlPattern: string;\n\t/** Regular expression source matched against the class and id of loading indicators. */\n\tessentialPattern: string;\n};\n\ntype TrackedElement = {\n\tsignature: string;\n\t/**\n\t * When the script touched the element in a way that is itself a change (an attribute, a\n\t * scroll), provided the element was showing. Only counted once a visible change follows.\n\t */\n\tinitial: number | null;\n\t/** When the element was seen to look different from the sample before. */\n\ttimes: number[];\n\t/** When the element came into view during the watch. Null when it was showing all along. */\n\tappearedAt: number | null;\n\t/** Still inside the run of changes that brought the element into view. */\n\tentering: boolean;\n\t/** When the element was last touched or seen to change. */\n\tlastActivity: number;\n\twasShown: boolean;\n\t/** The element or an ancestor is fixed to the viewport. */\n\tfixed: boolean;\n};\n\ntype ObservationState = {\n\tstart: number;\n\ttracked: Map<Element, TrackedElement>;\n\t/** When each short animation on an element was first seen. */\n\tstarts: Map<Element, number[]>;\n\t/** Elements seen showing at some point during the watch. */\n\tshownOnce: WeakSet<Element>;\n\tvideos: Map<HTMLVideoElement, { time: number; playing: boolean }>;\n\tpoll: () => void;\n\tstop: () => void;\n};\n\n/**\n * Start watching the page for movement nothing asked for. Records, on `window[stateKey]`, when\n * elements a script touches change position, size, visibility or scroll offset, and when short\n * animations start. Changes that bring an element into view (a banner sliding in, a slot being\n * filled) are its entrance, not movement, and are left out: a run of changes ends once\n * `quietGapMs` passes without one. collectRegionsScript reads the record and stops the watch.\n */\nexport function startObservationScript(\n\tstateKey: string,\n\tpollMs: number,\n\tdurationLimitMs: number,\n\ttrackLimit: number,\n\tquietGapMs: number,\n): void {\n\tconst TIMES_LIMIT = 400;\n\t// SVG is moved by rewriting its geometry attributes as often as by styling it.\n\tconst SVG_ATTRIBUTES = [\n\t\t\"transform\",\n\t\t\"d\",\n\t\t\"points\",\n\t\t\"x\",\n\t\t\"y\",\n\t\t\"x1\",\n\t\t\"y1\",\n\t\t\"x2\",\n\t\t\"y2\",\n\t\t\"cx\",\n\t\t\"cy\",\n\t\t\"r\",\n\t\t\"rx\",\n\t\t\"ry\",\n\t\t\"width\",\n\t\t\"height\",\n\t\t\"viewBox\",\n\t];\n\t// An entrance that never pauses stops being an entrance after this many quiet gaps.\n\tconst ENTRANCE_GAPS = 2;\n\t// With the watch full, an element that changed in the past makes room once it has been still for\n\t// this many quiet gaps.\n\tconst EVICT_GAPS = 3;\n\tconst store = window as unknown as Record<string, ObservationState | undefined>;\n\n\tstore[stateKey]?.stop();\n\n\tconst start = performance.now();\n\tconst tracked = new Map<Element, TrackedElement>();\n\tconst starts = new Map<Element, number[]>();\n\tconst shownOnce = new WeakSet<Element>();\n\t// When each element the page inserted during the watch was inserted.\n\tconst added = new WeakMap<Element, number>();\n\tconst seenAnimations = new WeakSet<Animation>();\n\tconst videos = new Map<HTMLVideoElement, { time: number; playing: boolean }>();\n\n\t// What an element looks like from the outside: where it is, how large, whether it shows, how far\n\t// it has scrolled and what image it carries. Text is left out on purpose, since a clock or a\n\t// counter updating is not movement.\n\tconst signatureOf = (el: Element): string => {\n\t\tconst rect = el.getBoundingClientRect();\n\t\tconst style = getComputedStyle(el);\n\n\t\treturn [\n\t\t\tMath.round(rect.left + window.scrollX),\n\t\t\tMath.round(rect.top + window.scrollY),\n\t\t\tMath.round(rect.width),\n\t\t\tMath.round(rect.height),\n\t\t\tMath.round(Number.parseFloat(style.opacity) * 20),\n\t\t\tstyle.visibility,\n\t\t\tstyle.transform,\n\t\t\tMath.round(el.scrollLeft),\n\t\t\tMath.round(el.scrollTop),\n\t\t\tstyle.backgroundPosition,\n\t\t\tstyle.backgroundImage.slice(0, 120),\n\t\t\t(el as HTMLImageElement).currentSrc ?? \"\",\n\t\t\t// A rotation about its own centre leaves a shape's box where it was.\n\t\t\tel instanceof SVGElement ? (el.getAttribute(\"transform\") ?? \"\") : \"\",\n\t\t].join(\"|\");\n\t};\n\n\tconst isFixed = (el: Element): boolean => {\n\t\tfor (let node: Element | null = el; node; node = node.parentElement) {\n\t\t\tif (getComputedStyle(node).position === \"fixed\") {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t};\n\n\t// Whether any of the element can be seen: rendered, not transparent or hidden, and lying at\n\t// least partly inside the document (inside the viewport, when it is fixed to it).\n\tconst isShown = (el: Element, fixed: boolean): boolean => {\n\t\tif (!el.isConnected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (typeof el.checkVisibility === \"function\") {\n\t\t\tif (\n\t\t\t\t!el.checkVisibility({\n\t\t\t\t\topacityProperty: true,\n\t\t\t\t\tvisibilityProperty: true,\n\t\t\t\t\tcontentVisibilityAuto: true,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tconst style = getComputedStyle(el);\n\n\t\t\tif (style.visibility !== \"visible\" || Number.parseFloat(style.opacity) === 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tconst rect = el.getBoundingClientRect();\n\n\t\tif (rect.width <= 0 || rect.height <= 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (fixed) {\n\t\t\treturn (\n\t\t\t\trect.right > 0 &&\n\t\t\t\trect.bottom > 0 &&\n\t\t\t\trect.left < window.innerWidth &&\n\t\t\t\trect.top < window.innerHeight\n\t\t\t);\n\t\t}\n\n\t\tconst root = document.documentElement;\n\n\t\treturn (\n\t\t\trect.right + window.scrollX > 0 &&\n\t\t\trect.bottom + window.scrollY > 0 &&\n\t\t\trect.left + window.scrollX < Math.max(root.scrollWidth, root.clientWidth) &&\n\t\t\trect.top + window.scrollY < Math.max(root.scrollHeight, root.clientHeight)\n\t\t);\n\t};\n\n\tconst addedAt = (el: Element): number | null => {\n\t\tfor (let node: Element | null = el; node; node = node.parentElement) {\n\t\t\tconst time = added.get(node);\n\n\t\t\tif (time !== undefined) {\n\t\t\t\treturn time;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t// Make room for one more element by dropping one that has settled: gone from the page, touched\n\t// without ever changing, or changed a while ago and still since.\n\tconst makeRoom = (now: number): boolean => {\n\t\tlet settled: Element | null = null;\n\n\t\tfor (const [el, record] of tracked) {\n\t\t\tconst idle = now - record.lastActivity;\n\n\t\t\tif (!el.isConnected || (record.times.length === 0 && idle > quietGapMs)) {\n\t\t\t\ttracked.delete(el);\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (settled === null && idle > quietGapMs * EVICT_GAPS) {\n\t\t\t\tsettled = el;\n\t\t\t}\n\t\t}\n\n\t\treturn settled !== null && tracked.delete(settled);\n\t};\n\n\t/**\n\t * `how` is what the script did: changed one of the element's own attributes or scrolled it\n\t * (`changed`), gave it children when it had none (`filled`), or changed its children some other\n\t * way (`children`).\n\t */\n\tconst track = (el: Element, how: \"changed\" | \"filled\" | \"children\"): void => {\n\t\tif (tracked.has(el) || el === document.documentElement || el === document.body) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst now = performance.now() - start;\n\n\t\tif (tracked.size >= trackLimit && !makeRoom(now)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst fixed = isFixed(el);\n\t\tconst shown = isShown(el, fixed);\n\t\tconst inserted = addedAt(el);\n\t\t// An element that cannot be seen yet, or that the page has only just put in, is arriving.\n\t\tconst entering = !shown || (inserted !== null && now - inserted <= quietGapMs);\n\n\t\tif (shown) {\n\t\t\tshownOnce.add(el);\n\t\t}\n\n\t\ttracked.set(el, {\n\t\t\tsignature: signatureOf(el),\n\t\t\t// Touching an element that is showing is the first sign of a change to it. Gaining\n\t\t\t// children is content arriving, which is not.\n\t\t\tinitial: how === \"changed\" && !entering ? now : null,\n\t\t\ttimes: [],\n\t\t\tappearedAt: inserted ?? (how === \"filled\" ? now : null),\n\t\t\tentering,\n\t\t\tlastActivity: now,\n\t\t\twasShown: shown,\n\t\t\tfixed,\n\t\t});\n\t};\n\n\tconst observer = new MutationObserver((records) => {\n\t\tconst now = performance.now() - start;\n\n\t\tfor (const record of records) {\n\t\t\tconst target = record.target instanceof Element ? record.target : record.target.parentElement;\n\n\t\t\tif (!target) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (record.type !== \"childList\") {\n\t\t\t\ttrack(target, \"changed\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst addedElements = [...record.addedNodes].filter((node) => node instanceof Element);\n\t\t\tconst removedElements = [...record.removedNodes].filter((node) => node instanceof Element);\n\n\t\t\tfor (const el of addedElements) {\n\t\t\t\tadded.set(el, now);\n\t\t\t}\n\n\t\t\t// Text swapped for other text is an update, not movement.\n\t\t\tif (addedElements.length === 0 && removedElements.length === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst filled =\n\t\t\t\tremovedElements.length === 0 && [...target.children].every((child) => added.has(child));\n\n\t\t\ttrack(target, filled ? \"filled\" : \"children\");\n\t\t}\n\t});\n\n\tconst observe = (root: Node): void => {\n\t\tobserver.observe(root, {\n\t\t\tsubtree: true,\n\t\t\tchildList: true,\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [\n\t\t\t\t\"style\",\n\t\t\t\t\"class\",\n\t\t\t\t\"hidden\",\n\t\t\t\t\"src\",\n\t\t\t\t\"srcset\",\n\t\t\t\t\"aria-hidden\",\n\t\t\t\t\"open\",\n\t\t\t\t...SVG_ATTRIBUTES,\n\t\t\t],\n\t\t});\n\t};\n\n\tobserve(document);\n\n\tfor (const el of document.querySelectorAll(\"*\")) {\n\t\tif (el.shadowRoot) {\n\t\t\tobserve(el.shadowRoot);\n\t\t}\n\t}\n\n\tconst onScroll = (event: Event): void => {\n\t\tif (event.target instanceof Element) {\n\t\t\ttrack(event.target, \"changed\");\n\t\t}\n\t};\n\n\tdocument.addEventListener(\"scroll\", onScroll, { capture: true, passive: true });\n\n\tfor (const video of document.querySelectorAll(\"video\")) {\n\t\tvideos.set(video, { time: video.currentTime, playing: !video.paused && !video.ended });\n\t}\n\n\tconst poll = (): void => {\n\t\tconst now = performance.now() - start;\n\n\t\tfor (const [el, record] of tracked) {\n\t\t\tif (!el.isConnected) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst signature = signatureOf(el);\n\t\t\tconst shown = isShown(el, record.fixed);\n\n\t\t\tif (shown) {\n\t\t\t\tshownOnce.add(el);\n\t\t\t}\n\n\t\t\tif (signature !== record.signature) {\n\t\t\t\trecord.signature = signature;\n\n\t\t\t\tif (record.entering) {\n\t\t\t\t\t// Coming into view: note when, and leave the changes that bring it in uncounted.\n\t\t\t\t\tif (shown && record.appearedAt === null) {\n\t\t\t\t\t\trecord.appearedAt = now;\n\t\t\t\t\t}\n\t\t\t\t} else if ((shown || record.wasShown) && record.times.length < TIMES_LIMIT) {\n\t\t\t\t\t// A change nobody could see, before or after, moved nothing.\n\t\t\t\t\trecord.times.push(now);\n\t\t\t\t}\n\n\t\t\t\trecord.lastActivity = now;\n\t\t\t}\n\n\t\t\tif (record.entering && shown) {\n\t\t\t\trecord.appearedAt ??= now;\n\n\t\t\t\t// The entrance is over once the element holds still, or has gone on too long to be one.\n\t\t\t\tif (\n\t\t\t\t\tnow - record.lastActivity > quietGapMs ||\n\t\t\t\t\tnow - record.appearedAt > quietGapMs * ENTRANCE_GAPS\n\t\t\t\t) {\n\t\t\t\t\trecord.entering = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trecord.wasShown = shown;\n\t\t}\n\n\t\tfor (const el of starts.keys()) {\n\t\t\tif (isShown(el, false)) {\n\t\t\t\tshownOnce.add(el);\n\t\t\t}\n\t\t}\n\n\t\tconst animations = typeof document.getAnimations === \"function\" ? document.getAnimations() : [];\n\n\t\tfor (const animation of animations) {\n\t\t\tconst effect = animation.effect;\n\t\t\tconst target = effect instanceof KeyframeEffect ? effect.target : null;\n\n\t\t\tif (!target || animation.playState !== \"running\" || seenAnimations.has(animation)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// A long animation is still there to be read when the window closes. A short one is not, so\n\t\t\t// note when it started: a run of them is how a script animates a carousel.\n\t\t\tif (Number(effect?.getComputedTiming().activeDuration) > durationLimitMs) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tseenAnimations.add(animation);\n\n\t\t\tconst times = starts.get(target) ?? [];\n\n\t\t\tif (times.length < TIMES_LIMIT) {\n\t\t\t\ttimes.push(now);\n\t\t\t}\n\n\t\t\tstarts.set(target, times);\n\t\t}\n\t};\n\n\tconst timer = setInterval(poll, pollMs);\n\n\tconst stop = (): void => {\n\t\tclearInterval(timer);\n\t\tobserver.disconnect();\n\t\tdocument.removeEventListener(\"scroll\", onScroll, { capture: true });\n\t\tdelete store[stateKey];\n\t};\n\n\tstore[stateKey] = { start, tracked, starts, shownOnce, videos, poll, stop };\n\n\tpoll();\n}\n\n/**\n * Stop the watch started by startObservationScript, if it is still running.\n */\nexport function stopObservationScript(stateKey: string): void {\n\t(window as unknown as Record<string, ObservationState | undefined>)[stateKey]?.stop();\n}\n\n/**\n * Stop the watch started by startObservationScript and gather what moved into regions, each with\n * the facts needed to judge it. The region elements and any pause controls found are left on\n * `window[stashKey]`.\n */\nexport function collectRegionsScript(\n\tstateKey: string,\n\tstashKey: string,\n\toptions: CollectOptions,\n): RegionCollection {\n\tconst ESSENTIAL_ROLES = new Set([\"progressbar\", \"status\", \"alert\", \"timer\", \"log\"]);\n\t// Things that act on the page they are in. A link goes somewhere else, so one beside a moving\n\t// region (\"Play trailer\", \"Stop-motion season\") is not a control for it.\n\tconst CONTROL_SELECTOR =\n\t\t'button, [role=\"button\"], [role=\"switch\"], input[type=\"button\"], input[type=\"submit\"], input[type=\"checkbox\"], summary';\n\t// A page-wide animation switch may be a link to a setting.\n\tconst PAGE_CONTROL_SELECTOR = `${CONTROL_SELECTOR}, a[href]`;\n\t// Properties whose animation shows and hides an element, so it can be seen some of the time.\n\tconst SHOWS_AND_HIDES = /^(opacity|visibility)$/i;\n\tconst KEYFRAME_FIELDS = new Set([\"offset\", \"computedOffset\", \"easing\", \"composite\"]);\n\tconst NAME_LIMIT = 40;\n\tconst RULE_LIMIT = 20000;\n\tconst PAGE_CONTROL_LIMIT = 2000;\n\tconst ANIMATION_LIMIT = 5;\n\tconst TIMES_LIMIT = 400;\n\t// How far outside the moving region a pause control may sit: this many ancestors up, as long as\n\t// the ancestor is not much larger than the region.\n\tconst CONTROL_ANCESTORS = 3;\n\tconst CONTROL_SCOPE_GROWTH = 6;\n\n\ttype Candidate = {\n\t\tel: Element;\n\t\t/** The elements actually moving, for matching stylesheet rules. */\n\t\ttargets: Element[];\n\t\ttimes: number[];\n\t\t/** Elements seen changing, and how many of them only appeared during the watch. */\n\t\tobserved: number;\n\t\tappeared: number;\n\t\tanimations: CollectedAnimation[];\n\t\tmarquee: { loop: number } | null;\n\t\tvideo: CollectedVideo | null;\n\t};\n\n\ttype Box = { left: number; top: number; right: number; bottom: number };\n\n\tconst store = window as unknown as Record<string, unknown>;\n\tconst state = store[stateKey] as ObservationState | undefined;\n\n\tstate?.poll();\n\tstate?.stop();\n\n\tconst elapsedMs = state ? performance.now() - state.start : 0;\n\n\tconst controlName = new RegExp(options.controlNamePattern, \"iu\");\n\tconst controlAttribute = new RegExp(options.controlAttributePattern, \"i\");\n\tconst pageControl = new RegExp(options.pageControlPattern, \"i\");\n\tconst essentialHint = new RegExp(options.essentialPattern, \"i\");\n\n\tconst isRoot = (el: Element | null): boolean =>\n\t\t!el || el === document.body || el === document.documentElement;\n\n\tconst isRendered = (el: Element): boolean => {\n\t\tif (!el.isConnected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (typeof el.checkVisibility === \"function\" && !el.checkVisibility()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst rect = el.getBoundingClientRect();\n\n\t\treturn rect.width > 0 && rect.height > 0;\n\t};\n\n\t// Rendered, and neither it nor an ancestor is transparent or `visibility: hidden`.\n\tconst isVisible = (el: Element): boolean => {\n\t\tif (!isRendered(el)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (typeof el.checkVisibility === \"function\") {\n\t\t\treturn el.checkVisibility({\n\t\t\t\topacityProperty: true,\n\t\t\t\tvisibilityProperty: true,\n\t\t\t\tcontentVisibilityAuto: true,\n\t\t\t});\n\t\t}\n\n\t\tfor (let node: Element | null = el; node; node = node.parentElement) {\n\t\t\tconst style = getComputedStyle(node);\n\n\t\t\tif (\n\t\t\t\tNumber.parseFloat(style.opacity) === 0 ||\n\t\t\t\t(node === el && style.visibility !== \"visible\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t};\n\n\t// Whether a moving element could be seen at the end of the watch or at some point during it. A\n\t// slide that has just faded out counts; a hidden preloader whose animation never stopped, or a\n\t// slide parked off-state the whole time, does not.\n\tconst wasVisible = (candidate: Candidate, el: Element): boolean =>\n\t\tisVisible(el) ||\n\t\tstate?.shownOnce.has(candidate.el) === true ||\n\t\t(isRendered(el) &&\n\t\t\t(isRoot(el.parentElement) || isVisible(el.parentElement!)) &&\n\t\t\tcandidate.animations.some(\n\t\t\t\t(animation) =>\n\t\t\t\t\tanimation.pseudoElement === null &&\n\t\t\t\t\tanimation.properties.some((property) => SHOWS_AND_HIDES.test(property)),\n\t\t\t));\n\n\tconst boxOf = (el: Element): Box => {\n\t\tconst rect = el.getBoundingClientRect();\n\n\t\treturn {\n\t\t\tleft: rect.left + window.scrollX,\n\t\t\ttop: rect.top + window.scrollY,\n\t\t\tright: rect.right + window.scrollX,\n\t\t\tbottom: rect.bottom + window.scrollY,\n\t\t};\n\t};\n\n\tconst areaOf = (box: Box): number =>\n\t\tMath.max(0, box.right - box.left) * Math.max(0, box.bottom - box.top);\n\n\tconst intersect = (a: Box, b: Box): Box => ({\n\t\tleft: Math.max(a.left, b.left),\n\t\ttop: Math.max(a.top, b.top),\n\t\tright: Math.min(a.right, b.right),\n\t\tbottom: Math.min(a.bottom, b.bottom),\n\t});\n\n\tconst clips = (el: Element): boolean => {\n\t\tconst style = getComputedStyle(el);\n\n\t\treturn style.overflowX !== \"visible\" || style.overflowY !== \"visible\";\n\t};\n\n\t// The part of the element a user can see: its box cut down by every ancestor that clips it and\n\t// by the edges of the document, or of the viewport when it is fixed there.\n\tconst visibleBox = (el: Element): Box => {\n\t\tconst root = document.documentElement;\n\t\tlet box = intersect(boxOf(el), {\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tright: Math.max(root.scrollWidth, root.clientWidth),\n\t\t\tbottom: Math.max(root.scrollHeight, root.clientHeight),\n\t\t});\n\n\t\tfor (let node: Element | null = el; !isRoot(node); node = node!.parentElement) {\n\t\t\tif (node !== el && clips(node!)) {\n\t\t\t\tbox = intersect(box, boxOf(node!));\n\t\t\t}\n\n\t\t\tif (getComputedStyle(node!).position === \"fixed\") {\n\t\t\t\tbox = intersect(box, {\n\t\t\t\t\tleft: window.scrollX,\n\t\t\t\t\ttop: window.scrollY,\n\t\t\t\t\tright: window.scrollX + window.innerWidth,\n\t\t\t\t\tbottom: window.scrollY + window.innerHeight,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn box;\n\t};\n\n\t// A track sliding inside a smaller clipping box is seen through that box, so the box is the\n\t// region.\n\tconst regionElementFor = (el: Element): Element => {\n\t\tfor (let parent = el.parentElement; !isRoot(parent); parent = parent!.parentElement) {\n\t\t\tif (clips(parent!)) {\n\t\t\t\treturn areaOf(boxOf(parent!)) < areaOf(boxOf(el)) - 1 ? parent! : el;\n\t\t\t}\n\t\t}\n\n\t\treturn el;\n\t};\n\n\tconst isEssential = (el: Element): boolean => {\n\t\tlet depth = 0;\n\n\t\tfor (let node: Element | null = el; !isRoot(node); node = node!.parentElement, depth++) {\n\t\t\tconst current = node!;\n\n\t\t\tif (\n\t\t\t\tESSENTIAL_ROLES.has(current.getAttribute(\"role\") ?? \"\") ||\n\t\t\t\tcurrent.getAttribute(\"aria-busy\") === \"true\" ||\n\t\t\t\tcurrent.tagName === \"PROGRESS\" ||\n\t\t\t\tcurrent.tagName === \"METER\"\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (depth < 3 && essentialHint.test(`${current.getAttribute(\"class\") ?? \"\"} ${current.id}`)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t};\n\n\tconst shallowHtml = (el: Element): string => (el.cloneNode(false) as Element).outerHTML;\n\n\tconst candidates = new Map<Element, Candidate>();\n\n\tconst candidateFor = (el: Element): Candidate => {\n\t\tlet candidate = candidates.get(el);\n\n\t\tif (!candidate) {\n\t\t\tcandidate = {\n\t\t\t\tel,\n\t\t\t\ttargets: [],\n\t\t\t\ttimes: [],\n\t\t\t\tobserved: 0,\n\t\t\t\tappeared: 0,\n\t\t\t\tanimations: [],\n\t\t\t\tmarquee: null,\n\t\t\t\tvideo: null,\n\t\t\t};\n\t\t\tcandidates.set(el, candidate);\n\t\t}\n\n\t\treturn candidate;\n\t};\n\n\t// Movement seen while watching: elements that changed, and short animations that kept starting.\n\tif (state) {\n\t\tfor (const [el, record] of state.tracked) {\n\t\t\t// Being touched by a script is not movement until the element is seen to look different.\n\t\t\tif (record.times.length >= 1) {\n\t\t\t\tconst candidate = candidateFor(el);\n\t\t\t\tcandidate.targets.push(el);\n\t\t\t\tcandidate.times.push(...(record.initial === null ? [] : [record.initial]), ...record.times);\n\t\t\t\tcandidate.observed++;\n\t\t\t\tcandidate.appeared += record.appearedAt === null ? 0 : 1;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [el, times] of state.starts) {\n\t\t\tif (times.length >= 2) {\n\t\t\t\tconst candidate = candidateFor(el);\n\t\t\t\tcandidate.targets.push(el);\n\t\t\t\tcandidate.times.push(...times);\n\t\t\t\tcandidate.observed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// An animated pseudo-element is sized by itself where its size can be read: a ten-pixel dot\n\t// blinking in the corner of a card is not the card moving.\n\tconst pseudoAreaOf = (el: Element, pseudo: string): number | null => {\n\t\tconst style = getComputedStyle(el, pseudo);\n\t\tconst width = Number.parseFloat(style.width);\n\t\tconst height = Number.parseFloat(style.height);\n\n\t\treturn Number.isFinite(width) && Number.isFinite(height) ? width * height : null;\n\t};\n\n\tconst smallPseudoHosts = new Set<Element>();\n\n\t// Animations still running that outlast the limit.\n\tconst running = typeof document.getAnimations === \"function\" ? document.getAnimations() : [];\n\n\tfor (const animation of running) {\n\t\tconst effect = animation.effect;\n\n\t\tif (!(effect instanceof KeyframeEffect) || !effect.target) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (animation.playState !== \"running\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst activeDuration = Number(effect.getComputedTiming().activeDuration);\n\n\t\tif (!(activeDuration > options.durationLimitMs)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet properties: string[] = [];\n\t\tlet readable = true;\n\n\t\ttry {\n\t\t\tconst keyframes = effect.getKeyframes();\n\t\t\tconst values = new Map<string, Set<string>>();\n\t\t\tconst counts = new Map<string, number>();\n\n\t\t\tfor (const keyframe of keyframes) {\n\t\t\t\tfor (const [property, value] of Object.entries(keyframe)) {\n\t\t\t\t\tif (KEYFRAME_FIELDS.has(property)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvalues.set(property, (values.get(property) ?? new Set()).add(String(value)));\n\t\t\t\t\tcounts.set(property, (counts.get(property) ?? 0) + 1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A property missing from a keyframe animates from or to the element's own value.\n\t\t\tproperties = [...values.keys()].filter(\n\t\t\t\t(property) =>\n\t\t\t\t\tvalues.get(property)!.size > 1 || (counts.get(property) ?? 0) < keyframes.length,\n\t\t\t);\n\t\t} catch {\n\t\t\treadable = false;\n\t\t}\n\n\t\t// Keyframes that all say the same thing change nothing on screen.\n\t\tif (readable && properties.length === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst pseudoElement = effect.pseudoElement ?? null;\n\t\tconst pseudoArea = pseudoElement === null ? null : pseudoAreaOf(effect.target, pseudoElement);\n\n\t\tif (pseudoArea !== null && pseudoArea < options.minRegionArea) {\n\t\t\tsmallPseudoHosts.add(effect.target);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst css = \"animationName\" in animation;\n\t\tconst candidate = candidateFor(effect.target);\n\n\t\tcandidate.targets.push(effect.target);\n\n\t\tif (candidate.animations.length < ANIMATION_LIMIT) {\n\t\t\tcandidate.animations.push({\n\t\t\t\tname: css\n\t\t\t\t\t? String((animation as CSSAnimation).animationName)\n\t\t\t\t\t: animation.id !== \"\"\n\t\t\t\t\t\t? animation.id\n\t\t\t\t\t\t: null,\n\t\t\t\tcss,\n\t\t\t\tinfinite: !Number.isFinite(activeDuration),\n\t\t\t\tactiveDurationMs: Number.isFinite(activeDuration) ? Math.round(activeDuration) : null,\n\t\t\t\tproperties,\n\t\t\t\tpseudoElement,\n\t\t\t\tpseudoArea,\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const marquee of document.querySelectorAll(\"marquee\")) {\n\t\tif (marquee.getAttribute(\"scrollamount\") === \"0\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst loop = Number.parseInt(marquee.getAttribute(\"loop\") ?? \"-1\", 10);\n\t\tconst candidate = candidateFor(marquee);\n\n\t\tcandidate.targets.push(marquee);\n\t\tcandidate.marquee = { loop: Number.isNaN(loop) ? -1 : loop };\n\t}\n\n\tfor (const video of document.querySelectorAll(\"video\")) {\n\t\tif (video.paused || video.ended) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst before = state?.videos.get(video);\n\t\tconst candidate = candidateFor(video);\n\n\t\tcandidate.targets.push(video);\n\t\tcandidate.video = {\n\t\t\tcontrols: video.controls,\n\t\t\tendless: video.loop || video.duration === Number.POSITIVE_INFINITY,\n\t\t\tdurationS: Number.isFinite(video.duration) ? video.duration : null,\n\t\t\tplayingAtStart: before?.playing ?? false,\n\t\t\tadvanced: before !== undefined && video.currentTime !== before.time,\n\t\t};\n\t}\n\n\t// Lift each moving element to the region it is seen through, and drop what cannot be seen or is\n\t// a loading indicator.\n\tlet essential = 0;\n\tconst lifted = new Map<Element, Candidate>();\n\n\tconst mergeInto = (into: Candidate, from: Candidate): void => {\n\t\tinto.targets.push(...from.targets);\n\t\tinto.times.push(...from.times);\n\t\tinto.observed += from.observed;\n\t\tinto.appeared += from.appeared;\n\t\tinto.animations.push(...from.animations.slice(0, ANIMATION_LIMIT - into.animations.length));\n\t\tinto.marquee ??= from.marquee;\n\t\tinto.video ??= from.video;\n\t};\n\n\tfor (const candidate of candidates.values()) {\n\t\t// The browser animates a <marquee> through an element inside it that the page cannot reach.\n\t\tconst host = (candidate.el.getRootNode() as ShadowRoot).host;\n\t\tconst el = host?.tagName === \"MARQUEE\" ? host : candidate.el;\n\n\t\tif (isRoot(el) || !wasVisible(candidate, el)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isEssential(el)) {\n\t\t\tessential++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst regionEl = regionElementFor(el);\n\t\tconst existing = lifted.get(regionEl);\n\n\t\tif (existing) {\n\t\t\tmergeInto(existing, candidate);\n\t\t} else {\n\t\t\tlifted.set(regionEl, { ...candidate, el: regionEl });\n\t\t}\n\t}\n\n\t// A moving element inside another moving element is part of it.\n\tconst depthOf = (el: Element): number => {\n\t\tlet depth = 0;\n\n\t\tfor (let node = el.parentElement; node; node = node.parentElement) {\n\t\t\tdepth++;\n\t\t}\n\n\t\treturn depth;\n\t};\n\n\tlet regions: Candidate[] = [];\n\n\tfor (const candidate of [...lifted.values()].sort((a, b) => depthOf(a.el) - depthOf(b.el))) {\n\t\tconst outer = regions.find((region) => region.el.contains(candidate.el));\n\n\t\tif (outer) {\n\t\t\tmergeInto(outer, candidate);\n\t\t} else {\n\t\t\tregions.push(candidate);\n\t\t}\n\t}\n\n\t// Slides stacked on top of each other, each fading in turn, are one carousel: join regions that\n\t// mostly overlap under their common parent.\n\tconst commonAncestor = (a: Element, b: Element): Element | null => {\n\t\tfor (let node: Element | null = a; node; node = node.parentElement) {\n\t\t\tif (node.contains(b)) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfor (let merged = true; merged; ) {\n\t\tmerged = false;\n\n\t\tsearch: for (const a of regions) {\n\t\t\tfor (const b of regions) {\n\t\t\t\tif (a === b) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst boxA = visibleBox(a.el);\n\t\t\t\tconst boxB = visibleBox(b.el);\n\t\t\t\tconst smaller = Math.min(areaOf(boxA), areaOf(boxB));\n\n\t\t\t\tif (smaller === 0 || areaOf(intersect(boxA, boxB)) < smaller / 2) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst ancestor = commonAncestor(a.el, b.el);\n\t\t\t\tconst union = areaOf({\n\t\t\t\t\tleft: Math.min(boxA.left, boxB.left),\n\t\t\t\t\ttop: Math.min(boxA.top, boxB.top),\n\t\t\t\t\tright: Math.max(boxA.right, boxB.right),\n\t\t\t\t\tbottom: Math.max(boxA.bottom, boxB.bottom),\n\t\t\t\t});\n\t\t\t\tconst [keep, drop] = areaOf(boxA) >= areaOf(boxB) ? [a, b] : [b, a];\n\n\t\t\t\tmergeInto(keep, drop);\n\n\t\t\t\tif (ancestor && !isRoot(ancestor) && areaOf(visibleBox(ancestor)) <= union * 4) {\n\t\t\t\t\tkeep.el = ancestor;\n\t\t\t\t}\n\n\t\t\t\tregions = regions.filter((region) => region !== drop);\n\t\t\t\tmerged = true;\n\t\t\t\tbreak search;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Stylesheet rules that pause an animation on hover or focus, and rules under a\n\t// prefers-reduced-motion query that touch animation.\n\tconst pauseRules: { selector: string; on: \"hover\" | \"focus\" }[] = [];\n\tconst reducedMotionSelectors: string[] = [];\n\tlet rulesSeen = 0;\n\n\tconst walkRules = (rules: CSSRuleList, reduced: boolean): void => {\n\t\tfor (const rule of rules) {\n\t\t\tif (rulesSeen++ > RULE_LIMIT) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst condition =\n\t\t\t\t(rule as CSSMediaRule).media?.mediaText ?? (rule as CSSConditionRule).conditionText ?? \"\";\n\t\t\tconst nowReduced = reduced || condition.includes(\"prefers-reduced-motion\");\n\t\t\tconst selector = (rule as CSSStyleRule).selectorText;\n\t\t\tconst style = (rule as CSSStyleRule).style;\n\n\t\t\tif (selector && style) {\n\t\t\t\tif (\n\t\t\t\t\tnowReduced &&\n\t\t\t\t\t(style.animationName ||\n\t\t\t\t\t\tstyle.animationDuration ||\n\t\t\t\t\t\tstyle.animationPlayState ||\n\t\t\t\t\t\tstyle.animationIterationCount ||\n\t\t\t\t\t\tstyle.transitionDuration ||\n\t\t\t\t\t\tstyle.transitionProperty)\n\t\t\t\t) {\n\t\t\t\t\treducedMotionSelectors.push(selector);\n\t\t\t\t}\n\n\t\t\t\tif (style.animationPlayState === \"paused\" || style.animationName === \"none\") {\n\t\t\t\t\tif (selector.includes(\":hover\")) {\n\t\t\t\t\t\tpauseRules.push({ selector, on: \"hover\" });\n\t\t\t\t\t}\n\n\t\t\t\t\tif (selector.includes(\":focus\")) {\n\t\t\t\t\t\tpauseRules.push({ selector, on: \"focus\" });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst nested = (rule as CSSGroupingRule).cssRules;\n\n\t\t\tif (nested) {\n\t\t\t\twalkRules(nested, nowReduced);\n\t\t\t}\n\t\t}\n\t};\n\n\tfor (const sheet of [...document.styleSheets, ...(document.adoptedStyleSheets ?? [])]) {\n\t\ttry {\n\t\t\twalkRules(sheet.cssRules, false);\n\t\t} catch {\n\t\t\t// A cross-origin stylesheet cannot be read.\n\t\t}\n\t}\n\n\tconst matches = (el: Element, selector: string): boolean => {\n\t\ttry {\n\t\t\treturn el.matches(selector);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\t// The selector with its hover and focus conditions taken as met.\n\tconst withoutState = (selector: string): string =>\n\t\tselector\n\t\t\t.replace(/(^|[\\s>+~,(])(?::hover|:focus-within|:focus-visible|:focus)+/g, \"$1*\")\n\t\t\t.replace(/:hover|:focus-within|:focus-visible|:focus/g, \"\");\n\n\tconst nameOf = (el: Element): string => {\n\t\tconst labelledBy = (el.getAttribute(\"aria-labelledby\") ?? \"\")\n\t\t\t.split(/\\s+/)\n\t\t\t.map((id) => (id ? (document.getElementById(id)?.textContent ?? \"\") : \"\"))\n\t\t\t.join(\" \");\n\t\tconst labels = [...((el as HTMLInputElement).labels ?? [])]\n\t\t\t.map((label) => label.textContent ?? \"\")\n\t\t\t.join(\" \");\n\t\tconst name =\n\t\t\tel.getAttribute(\"aria-label\") ||\n\t\t\tlabelledBy.trim() ||\n\t\t\tlabels.trim() ||\n\t\t\t(el.textContent ?? \"\").trim() ||\n\t\t\tel.getAttribute(\"title\") ||\n\t\t\tel.querySelector(\"img[alt]\")?.getAttribute(\"alt\") ||\n\t\t\t(el as HTMLInputElement).value ||\n\t\t\t\"\";\n\n\t\treturn String(name).replace(/\\s+/g, \" \").trim();\n\t};\n\n\tconst stash: Element[] = [];\n\n\tconst stashIndex = (el: Element): number => {\n\t\tconst index = stash.indexOf(el);\n\n\t\treturn index === -1 ? stash.push(el) - 1 : index;\n\t};\n\n\tconst toControl = (el: Element, foundBy: CollectedControl[\"foundBy\"]): CollectedControl => ({\n\t\telementIndex: stashIndex(el),\n\t\thtml: shallowHtml(el),\n\t\tname: nameOf(el).slice(0, NAME_LIMIT),\n\t\tfoundBy,\n\t});\n\n\tlet pageControlEl: Element | null | undefined;\n\n\tconst findPageControl = (): Element | null => {\n\t\tif (pageControlEl === undefined) {\n\t\t\tpageControlEl = null;\n\n\t\t\tlet seen = 0;\n\n\t\t\tfor (const el of document.querySelectorAll(PAGE_CONTROL_SELECTOR)) {\n\t\t\t\tif (seen++ > PAGE_CONTROL_LIMIT) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (pageControl.test(nameOf(el)) && isRendered(el)) {\n\t\t\t\t\tpageControlEl = el;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn pageControlEl;\n\t};\n\n\tconst findControl = (regionEl: Element, regionArea: number): CollectedControl | null => {\n\t\tconst scopes = [regionEl];\n\n\t\tfor (\n\t\t\tlet parent = regionEl.parentElement, level = 0;\n\t\t\t!isRoot(parent) && level < CONTROL_ANCESTORS;\n\t\t\tparent = parent!.parentElement, level++\n\t\t) {\n\t\t\tif (areaOf(boxOf(parent!)) > regionArea * CONTROL_SCOPE_GROWTH) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tscopes.push(parent!);\n\t\t}\n\n\t\tconst outermost = scopes[scopes.length - 1]!;\n\t\tconst nearby = [...outermost.querySelectorAll(CONTROL_SELECTOR)];\n\n\t\tif (regionEl.id) {\n\t\t\tnearby.push(...document.querySelectorAll(`[aria-controls~=\"${CSS.escape(regionEl.id)}\"]`));\n\t\t}\n\n\t\tconst rendered = nearby.filter(isRendered);\n\t\t// A long label is a link or a heading inside the moving content, not a control for it.\n\t\tconst named = rendered.find((el) => {\n\t\t\tconst name = nameOf(el);\n\n\t\t\treturn name.length <= NAME_LIMIT && controlName.test(name);\n\t\t});\n\n\t\tif (named) {\n\t\t\treturn toControl(named, \"name\");\n\t\t}\n\n\t\tconst hinted = rendered.find(\n\t\t\t(el) =>\n\t\t\t\tnameOf(el) === \"\" && controlAttribute.test(`${el.getAttribute(\"class\") ?? \"\"} ${el.id}`),\n\t\t);\n\n\t\tif (hinted) {\n\t\t\treturn toControl(hinted, \"attribute\");\n\t\t}\n\n\t\tconst pageWide = findPageControl();\n\n\t\treturn pageWide ? toControl(pageWide, \"page-control\") : null;\n\t};\n\n\t// Elements whose only movement is a pseudo-element too small to report.\n\tlet tooSmall = [...smallPseudoHosts].filter(\n\t\t(host) => isVisible(host) && !regions.some((region) => region.el.contains(host)),\n\t).length;\n\tconst sized: { candidate: Candidate; box: Box }[] = [];\n\n\tfor (const candidate of regions) {\n\t\tconst box = visibleBox(candidate.el);\n\t\tconst area = areaOf(box);\n\n\t\tif (area === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (area < options.minRegionArea) {\n\t\t\ttooSmall++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tsized.push({ candidate, box });\n\t}\n\n\tsized.sort((a, b) => areaOf(b.box) - areaOf(a.box));\n\n\tconst collected: CollectedRegion[] = sized\n\t\t.slice(0, options.regionLimit)\n\t\t.map(({ candidate, box }) => {\n\t\t\tconst cssTargets = candidate.animations.some((animation) => animation.css)\n\t\t\t\t? [...new Set(candidate.targets)]\n\t\t\t\t: [];\n\t\t\tconst pausesOn = ([\"hover\", \"focus\"] as const).filter((on) =>\n\t\t\t\tpauseRules.some(\n\t\t\t\t\t(rule) =>\n\t\t\t\t\t\trule.on === on && cssTargets.some((el) => matches(el, withoutState(rule.selector))),\n\t\t\t\t),\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\telementIndex: stashIndex(candidate.el),\n\t\t\t\thtml: shallowHtml(candidate.el),\n\t\t\t\trect: {\n\t\t\t\t\tx: Math.round(box.left),\n\t\t\t\t\ty: Math.round(box.top),\n\t\t\t\t\twidth: Math.round(box.right - box.left),\n\t\t\t\t\theight: Math.round(box.bottom - box.top),\n\t\t\t\t},\n\t\t\t\ttimes: [...new Set(candidate.times.map((time) => Math.round(time)))]\n\t\t\t\t\t.sort((a, b) => a - b)\n\t\t\t\t\t.slice(0, TIMES_LIMIT),\n\t\t\t\tappeared: candidate.observed > 0 && candidate.appeared === candidate.observed,\n\t\t\t\tanimations: candidate.animations,\n\t\t\t\tmarquee: candidate.marquee,\n\t\t\t\tvideo: candidate.video,\n\t\t\t\tcontrol: findControl(candidate.el, areaOf(box)),\n\t\t\t\tpausesOn,\n\t\t\t\treducedMotion:\n\t\t\t\t\tcssTargets.length === 0\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: cssTargets.some((el) =>\n\t\t\t\t\t\t\t\treducedMotionSelectors.some((selector) => matches(el, selector)),\n\t\t\t\t\t\t\t),\n\t\t\t};\n\t\t});\n\n\tstore[stashKey] = stash;\n\n\treturn {\n\t\telapsedMs: Math.round(elapsedMs),\n\t\tregions: collected,\n\t\ttotal: sized.length,\n\t\ttooSmall,\n\t\tessential,\n\t};\n}\n\nexport function scrollPositionScript(): { x: number; y: number } {\n\treturn { x: window.scrollX, y: window.scrollY };\n}\n\nexport function restoreScrollScript(position: { x: number; y: number }): void {\n\twindow.scrollTo({ left: position.x, top: position.y, behavior: \"instant\" });\n}\n","import type { CollectedRegion } from \"./browser-scripts\";\n\nexport type MotionKind = \"video\" | \"marquee\" | \"css-animation\" | \"web-animation\" | \"script\";\n\nexport type DetectedBy = \"media-element\" | \"element\" | \"animation-api\" | \"dom-observation\";\n\nexport type MovingContentFinding =\n\t/** Failed: a large region kept moving and nothing pauses it. */\n\t| \"no-pause-control\"\n\t/** Passed: a control that pauses, stops or hides the movement was found. */\n\t| \"pause-control\"\n\t/** Passed: the video has the browser's own controls. */\n\t| \"native-controls\"\n\t/** Review: the movement only pauses while hovered, which a keyboard user cannot do. */\n\t| \"pauses-on-hover\"\n\t/** Review: the movement pauses while focus is inside it. */\n\t| \"pauses-on-focus\"\n\t/** Review: the region is small enough that it may be decoration. */\n\t| \"small-region\"\n\t/** Review: the animation changes colour or shading, not position, size or visibility. */\n\t| \"subtle-animation\"\n\t/** Review: the region changed late in the window but was not seen to keep changing. */\n\t| \"changed-once\"\n\t/** Review: only a pseudo-element is animated, and its size could not be read. */\n\t| \"pseudo-element\"\n\t/** Review: the `<marquee>` stops by itself after a set number of loops. */\n\t| \"finite-loop\"\n\t/** Review: the video started during the window, or its length is unknown. */\n\t| \"uncertain-playback\";\n\nexport type Verdict = \"failed\" | \"needsReview\" | \"passed\";\n\nexport type Classification = {\n\tverdict: Verdict;\n\tfinding: MovingContentFinding;\n\tmotion: MotionKind;\n\tdetectedBy: DetectedBy;\n\tobservedMs: number;\n};\n\nexport type ClassifyOptions = {\n\t/** How long the page was observed for. */\n\tobservedMs: number;\n\t/** WCAG's limit: movement that stops within this long is allowed. */\n\tdurationLimitMs: number;\n\t/** Regions at least this large can fail. */\n\tlargeRegionArea: number;\n\t/**\n\t * Changes further apart than this belong to separate bursts of movement. Defaults to a tenth of\n\t * the window.\n\t */\n\tquietGapMs?: number;\n};\n\n/** The quiet gap used when none is given, as a fraction of the observation window. */\nexport const QUIET_GAP_FRACTION = 0.1;\n\n// Movement has to be seen this far into the window to count as still going.\nconst LATE_FRACTION = 0.6;\n\n// One unbroken burst of movement counts as sustained when it lasts this much of the window.\nconst CONTINUOUS_FRACTION = 0.4;\n\n// Properties whose animation moves, resizes, shows or hides something. An animation of anything\n// else (colour, shadow, filter) is reported for review.\nconst MOTION_PROPERTY =\n\t/transform|translate|rotate|scale|^left$|^top$|^right$|^bottom$|inset|margin|padding|backgroundPosition|background-position|offset|width|height|opacity|visibility|clip|strokeDash|stroke-dash|^d$|^x$|^y$/i;\n\ntype Evidence = {\n\tmotion: MotionKind;\n\tdetectedBy: DetectedBy;\n\t/** Null when the evidence is strong. */\n\tdoubt: MovingContentFinding | null;\n\tobservedMs: number;\n};\n\nfunction videoEvidence(region: CollectedRegion, options: ClassifyOptions): Evidence | null {\n\tconst video = region.video;\n\n\tif (!video) {\n\t\treturn null;\n\t}\n\n\tconst knownShort =\n\t\t!video.endless && video.durationS !== null && video.durationS * 1000 <= options.durationLimitMs;\n\n\tif (knownShort) {\n\t\treturn null;\n\t}\n\n\tconst certain =\n\t\tvideo.playingAtStart && video.advanced && (video.endless || video.durationS !== null);\n\n\treturn {\n\t\tmotion: \"video\",\n\t\tdetectedBy: \"media-element\",\n\t\tdoubt: certain ? null : \"uncertain-playback\",\n\t\tobservedMs: options.observedMs,\n\t};\n}\n\nfunction marqueeEvidence(region: CollectedRegion, options: ClassifyOptions): Evidence | null {\n\tif (!region.marquee) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tmotion: \"marquee\",\n\t\tdetectedBy: \"element\",\n\t\tdoubt: region.marquee.loop > 0 ? \"finite-loop\" : null,\n\t\tobservedMs: options.observedMs,\n\t};\n}\n\nfunction animationEvidence(region: CollectedRegion, options: ClassifyOptions): Evidence | null {\n\tif (region.animations.length === 0) {\n\t\treturn null;\n\t}\n\n\t// An animation on the element itself, or on a pseudo-element known to be large, moves the\n\t// region. One on a pseudo-element of unknown size may be a cursor or a dot.\n\tconst onRegion = region.animations.filter(\n\t\t(animation) =>\n\t\t\tanimation.pseudoElement === null ||\n\t\t\t(animation.pseudoArea !== null && animation.pseudoArea >= options.largeRegionArea),\n\t);\n\tconst moves = onRegion.some((animation) =>\n\t\tanimation.properties.some((property) => MOTION_PROPERTY.test(property)),\n\t);\n\n\treturn {\n\t\tmotion: region.animations.some((animation) => animation.css)\n\t\t\t? \"css-animation\"\n\t\t\t: \"web-animation\",\n\t\tdetectedBy: \"animation-api\",\n\t\tdoubt: onRegion.length === 0 ? \"pseudo-element\" : moves ? null : \"subtle-animation\",\n\t\tobservedMs: options.observedMs,\n\t};\n}\n\n/** Group sorted times into bursts: runs with no gap longer than `quietGapMs`. */\nfunction burstsOf(times: readonly number[], quietGapMs: number): number[][] {\n\tconst bursts: number[][] = [];\n\n\tfor (const time of times) {\n\t\tconst current = bursts.at(-1);\n\n\t\tif (current && time - current.at(-1)! <= quietGapMs) {\n\t\t\tcurrent.push(time);\n\t\t} else {\n\t\t\tbursts.push([time]);\n\t\t}\n\t}\n\n\treturn bursts;\n}\n\nfunction observationEvidence(region: CollectedRegion, options: ClassifyOptions): Evidence | null {\n\tconst window = Math.max(options.observedMs, 1);\n\tconst times = [...region.times].sort((a, b) => a - b);\n\tconst last = times.at(-1);\n\n\t// Movement that stopped before the last part of the window had settled.\n\tif (last === undefined || last < window * LATE_FRACTION) {\n\t\treturn null;\n\t}\n\n\tconst bursts = burstsOf(times, options.quietGapMs ?? window * QUIET_GAP_FRACTION);\n\tconst latest = bursts.at(-1)!;\n\t// Sustained movement comes back after a pause, like a carousel turning, or runs on without one,\n\t// like a ticker. A single short burst is one thing happening once: a banner sliding in, a slot\n\t// resizing, or one turn of a slow carousel.\n\tconst sustained =\n\t\tbursts.length >= 2 || latest.at(-1)! - latest[0]! >= window * CONTINUOUS_FRACTION;\n\n\tif (!sustained) {\n\t\t// One sample is a single snap. And one burst from content that only arrived during the\n\t\t// window is that content settling in.\n\t\tif (latest.length < 2 || region.appeared) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn {\n\t\tmotion: \"script\",\n\t\tdetectedBy: \"dom-observation\",\n\t\tdoubt: sustained ? null : \"changed-once\",\n\t\tobservedMs: Math.round(last),\n\t};\n}\n\n/**\n * Decide which list a moving region belongs in, or return null when the page facts do not show it\n * moving past the observation window.\n */\nexport function classifyRegion(\n\tregion: CollectedRegion,\n\toptions: ClassifyOptions,\n): Classification | null {\n\tconst all = [\n\t\tvideoEvidence(region, options),\n\t\tmarqueeEvidence(region, options),\n\t\tanimationEvidence(region, options),\n\t\tobservationEvidence(region, options),\n\t].filter((evidence): evidence is Evidence => evidence !== null);\n\n\t// Strong evidence first; within each, the order above.\n\tconst evidence = all.find(({ doubt }) => doubt === null) ?? all[0];\n\n\tif (!evidence) {\n\t\treturn null;\n\t}\n\n\tconst { motion, detectedBy, observedMs } = evidence;\n\tconst verdict = (verdict: Verdict, finding: MovingContentFinding): Classification => ({\n\t\tverdict,\n\t\tfinding,\n\t\tmotion,\n\t\tdetectedBy,\n\t\tobservedMs,\n\t});\n\n\tif (region.control) {\n\t\treturn verdict(\"passed\", \"pause-control\");\n\t}\n\n\tif (motion === \"video\" && region.video?.controls) {\n\t\treturn verdict(\"passed\", \"native-controls\");\n\t}\n\n\tif (evidence.doubt) {\n\t\treturn verdict(\"needsReview\", evidence.doubt);\n\t}\n\n\tif (motion === \"css-animation\" && region.pausesOn.includes(\"focus\")) {\n\t\treturn verdict(\"needsReview\", \"pauses-on-focus\");\n\t}\n\n\tif (motion === \"css-animation\" && region.pausesOn.includes(\"hover\")) {\n\t\treturn verdict(\"needsReview\", \"pauses-on-hover\");\n\t}\n\n\tif (region.rect.width * region.rect.height < options.largeRegionArea) {\n\t\treturn verdict(\"needsReview\", \"small-region\");\n\t}\n\n\treturn verdict(\"failed\", \"no-pause-control\");\n}\n"],"mappings":";AAAA;AAAA,EAEC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;;;AC6HtB,SAAS,uBACf,UACA,QACA,iBACA,YACA,YACO;AACP,QAAM,cAAc;AAEpB,QAAM,iBAAiB;AAAA,IACtB;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,gBAAgB;AAGtB,QAAM,aAAa;AACnB,QAAM,QAAQ;AAEd,QAAM,QAAQ,GAAG,KAAK;AAEtB,QAAM,QAAQ,YAAY,IAAI;AAC9B,QAAM,UAAU,oBAAI,IAA6B;AACjD,QAAM,SAAS,oBAAI,IAAuB;AAC1C,QAAM,YAAY,oBAAI,QAAiB;AAEvC,QAAM,QAAQ,oBAAI,QAAyB;AAC3C,QAAM,iBAAiB,oBAAI,QAAmB;AAC9C,QAAM,SAAS,oBAAI,IAA0D;AAK7E,QAAM,cAAc,CAAC,OAAwB;AAC5C,UAAM,OAAO,GAAG,sBAAsB;AACtC,UAAM,QAAQ,iBAAiB,EAAE;AAEjC,WAAO;AAAA,MACN,KAAK,MAAM,KAAK,OAAO,OAAO,OAAO;AAAA,MACrC,KAAK,MAAM,KAAK,MAAM,OAAO,OAAO;AAAA,MACpC,KAAK,MAAM,KAAK,KAAK;AAAA,MACrB,KAAK,MAAM,KA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AS,EAAE,WAAW,WAAW,WAAW,UAAU,WAAW,SAAS;AAAA,MAC3E;AAAA,IACD;AAAA,EACD,UAAE;AACD,UAAM,QAAQ,SAAS,uBAAuB,SAAS;AACvD,UAAM,uBAAuB,SAAS,SAAS;AAAA,EAChD;AACD;","names":["window","evidence","verdict"]}
|
package/dist/result.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Rect } from "@a11y-pulse/browser-adaptor";
|
|
2
|
+
import type { DetectedBy, MotionKind, MovingContentFinding } from "./classify";
|
|
3
|
+
export type MovingContentAnimation = {
|
|
4
|
+
/** The `animation-name`, the animation's `id`, or null when it has neither. */
|
|
5
|
+
name: string | null;
|
|
6
|
+
/** Whether the animation repeats forever. */
|
|
7
|
+
infinite: boolean;
|
|
8
|
+
/** How long the animation runs across all its iterations, or null when it is infinite. */
|
|
9
|
+
activeDurationMs: number | null;
|
|
10
|
+
/** The CSS properties whose value changes over the animation. */
|
|
11
|
+
properties: string[];
|
|
12
|
+
/** The pseudo-element the animation runs on, such as `::after`, or null for the element. */
|
|
13
|
+
pseudoElement: string | null;
|
|
14
|
+
};
|
|
15
|
+
export type MovingContentPauseControl = {
|
|
16
|
+
/** Selector for the control (see getSelector). */
|
|
17
|
+
selector: string;
|
|
18
|
+
/** Truncated opening tag. */
|
|
19
|
+
html: string;
|
|
20
|
+
/** The control's label, as far as the audit read it. */
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* `name`: a nearby button labelled pause, stop, play or hide. `attribute`: a nearby unlabelled
|
|
24
|
+
* control whose class or id says pause or stop. `page-control`: a control anywhere on the page
|
|
25
|
+
* that turns animation off.
|
|
26
|
+
*/
|
|
27
|
+
foundBy: "name" | "attribute" | "page-control";
|
|
28
|
+
};
|
|
29
|
+
export type MovingContentRegion = {
|
|
30
|
+
/** Selector for the moving region (see getSelector). */
|
|
31
|
+
selector: string;
|
|
32
|
+
/** Truncated opening tag. */
|
|
33
|
+
html: string;
|
|
34
|
+
/** The visible part of the region, in document coordinates. */
|
|
35
|
+
rect: Rect;
|
|
36
|
+
/** What is moving. `script` is movement driven by a script changing the page. */
|
|
37
|
+
motion: MotionKind;
|
|
38
|
+
/**
|
|
39
|
+
* How the movement was found: `animation-api` from the page's running animations,
|
|
40
|
+
* `dom-observation` from watching elements change position, `element` for `<marquee>` and
|
|
41
|
+
* `media-element` for a playing `<video>`.
|
|
42
|
+
*/
|
|
43
|
+
detectedBy: DetectedBy;
|
|
44
|
+
/** Why the region is in the list it is in. */
|
|
45
|
+
finding: MovingContentFinding;
|
|
46
|
+
/** How long into the observation window the region was last seen moving. */
|
|
47
|
+
observedMs: number;
|
|
48
|
+
/** The long-running animations on the region, for `css-animation` and `web-animation`. */
|
|
49
|
+
animations: MovingContentAnimation[];
|
|
50
|
+
/** The control found that can pause, stop or hide the movement, or null. */
|
|
51
|
+
pauseControl: MovingContentPauseControl | null;
|
|
52
|
+
/** States in which a stylesheet rule pauses the region's CSS animation. */
|
|
53
|
+
pausesOn: ("hover" | "focus")[];
|
|
54
|
+
/**
|
|
55
|
+
* Whether a `prefers-reduced-motion` rule applies to the region's CSS animation. Null when the
|
|
56
|
+
* movement is not a CSS animation, so the audit cannot tell. Supporting evidence only: the
|
|
57
|
+
* setting does not replace a way to pause.
|
|
58
|
+
*/
|
|
59
|
+
reducedMotion: boolean | null;
|
|
60
|
+
/**
|
|
61
|
+
* PNG bytes of the region at the end of the observation window. Only captured for failed and
|
|
62
|
+
* needs-review regions, and omitted past `screenshotLimit`.
|
|
63
|
+
*/
|
|
64
|
+
screenshot?: Uint8Array;
|
|
65
|
+
/** PNG bytes of the region `screenshotInterval` later, to compare with `screenshot`. */
|
|
66
|
+
laterScreenshot?: Uint8Array;
|
|
67
|
+
};
|
|
68
|
+
export type MovingContentResult = {
|
|
69
|
+
/** Large regions that kept moving past the observation window with no way to pause found. */
|
|
70
|
+
failed: MovingContentRegion[];
|
|
71
|
+
/** Moving regions where the evidence is weaker, for a human to check. */
|
|
72
|
+
needsReview: MovingContentRegion[];
|
|
73
|
+
/** Moving regions with a control that pauses, stops or hides them. */
|
|
74
|
+
passed: MovingContentRegion[];
|
|
75
|
+
/** How long the page was observed for. */
|
|
76
|
+
observedMs: number;
|
|
77
|
+
/** Full counts. */
|
|
78
|
+
summary: {
|
|
79
|
+
/** Moving regions examined, up to `regionLimit`. */
|
|
80
|
+
checked: number;
|
|
81
|
+
failed: number;
|
|
82
|
+
needsReview: number;
|
|
83
|
+
passed: number;
|
|
84
|
+
/** Moving regions past `regionLimit`, which were not examined. */
|
|
85
|
+
unchecked: number;
|
|
86
|
+
/** Moving content the audit leaves alone. */
|
|
87
|
+
ignored: {
|
|
88
|
+
/** Progress indicators, status messages and busy regions. */
|
|
89
|
+
essential: number;
|
|
90
|
+
/** Regions smaller than `minRegionArea`. */
|
|
91
|
+
tooSmall: number;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@a11y-pulse/moving-content-audit",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "WCAG 2.2.2 Pause, Stop, Hide audit that watches a page for content that keeps moving on its own for more than five seconds and looks for a way to pause it.",
|
|
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/moving-content-audit#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/A11y-Pulse/audits.git",
|
|
12
|
+
"directory": "packages/moving-content-audit"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/A11y-Pulse/audits/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"accessibility",
|
|
19
|
+
"a11y",
|
|
20
|
+
"wcag",
|
|
21
|
+
"pause-stop-hide",
|
|
22
|
+
"animation",
|
|
23
|
+
"carousel",
|
|
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
|
+
"playwright-core": "^1.65.0",
|
|
59
|
+
"puppeteer": "^25.16.0"
|
|
60
|
+
}
|
|
61
|
+
}
|