Scanner does not wait for client-side rendering before running axe scan
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- playwright, react, typescript
- Lĩnh vực
- accessibility, frontend, testing-qa
Hướng nghiên cứu
Bắt đầu trong .github/actions/find/src/findForUrl.ts và kiểm tra chuỗi từ page.goto(url) đến AxeBuilder.analyze(). Tái hiện quá trình quét trên một trang React được render phía client và xác minh rằng axe quan sát DOM đã được render thay vì phần tử root ban đầu; được xem là hoàn thành khi các phát hiện được báo cáo và thời điểm quét khớp với trang đã được render hoàn chỉnh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 374
- Fork
- 42
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/accessibility-scanner
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/accessibility-scanner#264 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
github/accessibility-scanner#260 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 50/100
github/accessibility-scanner#259 ·
-
Configurable issue labelsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
github/accessibility-scanner#245 ·
-
Sitemap SupportĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
github/accessibility-scanner#244 ·
Tất cả issue của github/accessibility-scanner
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
StabilityNexus/Fate-EVM-Frontend#153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
code-yeongyu/oh-my-openagent#9039 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Tencent/teamai-cli#862 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue hacktoberfest redis
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
libredb/libredb-studio#1164 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
flake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
coder/xum#4920 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày