Problem
When scanning single-page applications (React, Vue, Angular, etc.), the scanner runs the axe scan immediately after page.goto() resolves (which waits for the load event). At that point, the JavaScript bundles are loaded but the framework hasn't finished rendering the DOM yet. This means axe scans a nearly-empty <div id="root"> instead of the actual page content.
This leads to:
- False positives: Document-level violations like
landmark-one-main and page-has-heading-one are reported because the landmarks and headings haven't been rendered yet.
- False negatives: Element-level violations like
button-name are missed because the elements don't exist in the DOM yet.
- Misleading screenshots: Screenshots are taken after axe runs (inside
addFinding), by which time React has finished rendering. So the screenshots show the correct, fully-rendered page — even though axe scanned a different DOM state.
Steps to reproduce
- Set up the scanner against any React/SPA application
- Run a scan on a page that has proper
<main> landmarks and <h1> headings rendered by the framework
- Observe that
landmark-one-main and page-has-heading-one violations are reported
- Run axe dev tools manually in the browser on the same page — these violations are not found
- Observe that element-level violations found by axe dev tools (e.g.
button-name) are not reported by the scanner
Root cause
In findForUrl.ts:
await page.goto(url)
// axe runs immediately — no wait for client-side rendering
const rawFindings = await new AxeBuilder({page}).analyze()
page.goto() resolves on the load event, which fires when HTML/CSS/JS resources are loaded — but before the JS framework has executed and rendered the DOM.
Suggested fix
Add a wait for the page to be idle before running the axe scan. For example:
await page.goto(url)
await page.waitForLoadState('networkidle')
// or: await page.waitForTimeout(2000)
// or: await page.waitForFunction(() => document.querySelector('[data-testid]') !== null)
const rawFindings = await new AxeBuilder({page}).analyze()
waitForLoadState('networkidle') waits until there are no network connections for at least 500ms, which is a reasonable heuristic for "the SPA has finished its initial API calls and rendered."
Environment
github/accessibility-scanner@v2 (SHA: 7866232dda98e447fed8ec0d7798b322d888fd27)
- React 19 application with Mantine UI, served from Docker containers via Caddy
- Authenticated via
auth_context input with session cookies
Problem
When scanning single-page applications (React, Vue, Angular, etc.), the scanner runs the axe scan immediately after
page.goto()resolves (which waits for theloadevent). At that point, the JavaScript bundles are loaded but the framework hasn't finished rendering the DOM yet. This means axe scans a nearly-empty<div id="root">instead of the actual page content.This leads to:
landmark-one-mainandpage-has-heading-oneare reported because the landmarks and headings haven't been rendered yet.button-nameare missed because the elements don't exist in the DOM yet.addFinding), by which time React has finished rendering. So the screenshots show the correct, fully-rendered page — even though axe scanned a different DOM state.Steps to reproduce
<main>landmarks and<h1>headings rendered by the frameworklandmark-one-mainandpage-has-heading-oneviolations are reportedbutton-name) are not reported by the scannerRoot cause
In
findForUrl.ts:page.goto()resolves on theloadevent, which fires when HTML/CSS/JS resources are loaded — but before the JS framework has executed and rendered the DOM.Suggested fix
Add a wait for the page to be idle before running the axe scan. For example:
waitForLoadState('networkidle')waits until there are no network connections for at least 500ms, which is a reasonable heuristic for "the SPA has finished its initial API calls and rendered."Environment
github/accessibility-scanner@v2(SHA:7866232dda98e447fed8ec0d7798b322d888fd27)auth_contextinput with session cookies