Scanner does not wait for client-side rendering before running axe scan
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- playwright, react, typescript
調査の方向性
Start in .github/actions/find/src/findForUrl.ts and inspect the sequence from page.goto(url) to AxeBuilder.analyze(). Reproduce the scan against a client-rendered React page and verify that axe observes the rendered DOM rather than the initial root element; done means the reported findings and scan timing match the fully rendered page.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 374
- フォーク
- 42
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 7
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/accessibility-scanner のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
github/accessibility-scanner#264 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
github/accessibility-scanner#260 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 50/100
github/accessibility-scanner#259 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
github/accessibility-scanner#245 ·
-
Sitemap Support オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
github/accessibility-scanner#244 ·
github/accessibility-scanner の issue をすべて見る
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100