Scanner does not wait for client-side rendering before running axe scan
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- playwright, react, typescript
- Ambito
- accessibility, frontend, testing-qa
Direzione di ricerca
Inizia da .github/actions/find/src/findForUrl.ts e ispeziona la sequenza da page.goto(url) a AxeBuilder.analyze(). Riproduci la scansione su una pagina React renderizzata lato client e verifica che axe osservi il DOM renderizzato invece dell’elemento root iniziale; il lavoro è completato quando i risultati segnalati e la tempistica della scansione corrispondono alla pagina completamente renderizzata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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-mainandpage-has-heading-oneare reported because the landmarks and headings haven't been rendered yet. - False negatives: Element-level violations like
button-nameare 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-mainandpage-has-heading-oneviolations 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_contextinput with session cookies
- Lingua principale
- TypeScript
- Stelle
- 374
- Fork
- 42
- Merge medio
- 1g 13h
- PR unite (30g)
- 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/accessibility-scanner
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/accessibility-scanner#264 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
github/accessibility-scanner#260 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 50/100
github/accessibility-scanner#259 ·
-
Configurable issue labels Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
github/accessibility-scanner#245 ·
-
Sitemap Support Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
github/accessibility-scanner#244 ·
Tutte le issue di github/accessibility-scanner
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100