docs: add a reference for running axe-core without installing it - #4
Merged
Conversation
Method step 1 named axe-core but assumed a scanner was already installed. When one is not, the tempting move is to add @axe-core/cli as a dependency, which is wrong for a dev-time audit tool and puts a lockfile change in front of a reviewer for no reason. references/running-axe.md documents the alternative: inject axe-core into the running page. Covers a single page, a whole-sitemap run that loads each URL into a same-origin iframe from one host page, and how to validate the harness before trusting a clean result. Most of the file is failure modes, because each of them produces a silently wrong answer rather than an error: - The parent's axe.run() rejects a node from another document with "axe.run arguments are invalid". The frame needs its own axe instance. - A CDP Runtime.evaluate call caps out around 45 seconds, far short of a site-wide scan, so the loop has to run detached and be polled. - Hugo, Vite and webpack dev servers reload every open page on any file change, which wipes anything held on window. Checkpoint to localStorage after each page and make the loop resumable. - The host tab degrades over a few hundred pages, from roughly two pages per second to one per 45 seconds, while the server still answers in single-digit milliseconds. Diagnose before blaming the server; reload the tab and resume. - color-contrast measures rendered pixels, so too short a settle reports failures that do not reproduce. A 120ms settle produced four bogus pages in a 274-page run; all four were clean at 600ms, twice. The last one is why the file insists every flagged page is re-verified individually before it is reported. A batch loop is the wide net, not the evidence. Also states plainly that this is one pass of four and never supports a conformance claim on its own. validate.mjs now runs its emdash check over the new file as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Method step 1 named axe-core but assumed a scanner was already installed. When one is not, the tempting move is adding
@axe-core/clito the project, which is wrong for a dev-time audit tool and puts a lockfile change in front of a reviewer for no reason.references/running-axe.mddocuments injecting axe-core into the running page instead: a single page, a whole-sitemap run that loads each URL into a same-origin iframe from one host page, and how to validate the harness before trusting a clean result.Most of the file is failure modes, because each produces a silently wrong answer rather than an error:
TypeError: axe.run arguments are invalidwindowstate wiped mid-runfonts.readyplus a real delay; re-verify every hitThat last one is why the file insists each flagged page is re-verified individually before being reported. A batch loop is the wide net, not the evidence.
The file also states plainly that this is one pass of four and never supports a conformance claim on its own, consistent with the skill's existing position.
Test plan
node scripts/validate.mjspasses (A=31 AA=24 AAA=31 total=86)axe.run(document)on the same page; violations matchedvalidate.mjsnow covers the new file alongside the four existing authored docsNotes for review
The numbers quoted in the file (a 120ms settle producing four non-reproducing contrast pages in a 274-page run, the two-pages-per-second to one-per-45-seconds degradation) are observations from a single real run, not benchmarks. They are there to make the symptoms recognisable, and are described that way.