From 7189fc6f4dfd87e0124bd3ada1a5d16f733a87b9 Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:50:07 -0500 Subject: [PATCH 1/4] Add accessibility scanner workflow --- .github/workflows/a11y-scan.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/a11y-scan.yml diff --git a/.github/workflows/a11y-scan.yml b/.github/workflows/a11y-scan.yml new file mode 100644 index 0000000..5c533ab --- /dev/null +++ b/.github/workflows/a11y-scan.yml @@ -0,0 +1,15 @@ +name: Accessibility Scanner +on: workflow_dispatch + +jobs: + accessibility_scanner: + runs-on: ubuntu-latest + steps: + - uses: github/accessibility-scanner@v2 + with: + urls: | # Provide a newline-delimited list of URLs to scan; more information below. + REPLACE_THIS + repository: lindseywild/accessibility-scanner + token: ${{ secrets.GH_TOKEN }} + cache_key: cached_results-lindseywild-scanner-main.json + skip_copilot_assignment: true From f0c5a242ca99455669a3d68a63c671159152545d Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:05:02 -0500 Subject: [PATCH 2/4] Update a11y-scan.yml --- .github/workflows/a11y-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/a11y-scan.yml b/.github/workflows/a11y-scan.yml index 5c533ab..f635a81 100644 --- a/.github/workflows/a11y-scan.yml +++ b/.github/workflows/a11y-scan.yml @@ -7,7 +7,7 @@ jobs: steps: - uses: github/accessibility-scanner@v2 with: - urls: | # Provide a newline-delimited list of URLs to scan; more information below. + urls: | REPLACE_THIS repository: lindseywild/accessibility-scanner token: ${{ secrets.GH_TOKEN }} From 884aea619d359ecb7ae5b36af8c587ee37cc4ea4 Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:19:04 -0500 Subject: [PATCH 3/4] Update URLs for accessibility scan in workflow --- .github/workflows/a11y-scan.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/a11y-scan.yml b/.github/workflows/a11y-scan.yml index f635a81..a85a90c 100644 --- a/.github/workflows/a11y-scan.yml +++ b/.github/workflows/a11y-scan.yml @@ -8,7 +8,14 @@ jobs: - uses: github/accessibility-scanner@v2 with: urls: | - REPLACE_THIS + https://github.com + https://primer.style + https://primer.style/product/getting-started/foundations/layout/ # requires horizontal scrolling + https://primer.style/brand/primitives/color/ # Hex color cut off + https://primer.style/react/storybook/?path=/story/components-banner-features--actions-layout-inline # Buttons are overlapping + https://support.github.com/request/landing # 2d scroll + https://innovationgraph.github.com/ # Content disappears on mobile + https://github.com/partners/service-channel-partners # 2d scroll at 200% repository: lindseywild/accessibility-scanner token: ${{ secrets.GH_TOKEN }} cache_key: cached_results-lindseywild-scanner-main.json From 9376a5fa5ba796185309e7696728700841cf09a8 Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Thu, 5 Feb 2026 11:19:03 -0500 Subject: [PATCH 4/4] Refactor accessibility scan and add viewport check Refactor accessibility scan code and add viewport check for horizontal scrolling. --- .github/actions/find/src/findForUrl.ts | 54 ++++++++++++++++++++------ 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/actions/find/src/findForUrl.ts b/.github/actions/find/src/findForUrl.ts index 3bcd3fa..586870f 100644 --- a/.github/actions/find/src/findForUrl.ts +++ b/.github/actions/find/src/findForUrl.ts @@ -12,21 +12,51 @@ export async function findForUrl(url: string, authContext?: AuthContext): Promis console.log(`Scanning ${page.url()}`); let findings: Finding[] = []; + // try { + // const rawFindings = await new AxeBuilder({ page }).analyze(); + // findings = rawFindings.violations.map(violation => ({ + // scannerType: 'axe', + // url, + // html: violation.nodes[0].html.replace(/'/g, "'"), + // problemShort: violation.help.toLowerCase().replace(/'/g, "'"), + // problemUrl: violation.helpUrl.replace(/'/g, "'"), + // ruleId: violation.id, + // solutionShort: violation.description.toLowerCase().replace(/'/g, "'"), + // solutionLong: violation.nodes[0].failureSummary?.replace(/'/g, "'") + // })); + // } catch (e) { + // console.error('Error during axe accessibility scan:', e); + // } + + // Check for horizontal scrolling at 320x256 viewport try { - const rawFindings = await new AxeBuilder({ page }).analyze(); - findings = rawFindings.violations.map(violation => ({ - scannerType: 'axe', - url, - html: violation.nodes[0].html.replace(/'/g, "'"), - problemShort: violation.help.toLowerCase().replace(/'/g, "'"), - problemUrl: violation.helpUrl.replace(/'/g, "'"), - ruleId: violation.id, - solutionShort: violation.description.toLowerCase().replace(/'/g, "'"), - solutionLong: violation.nodes[0].failureSummary?.replace(/'/g, "'") - })); + // Wait for page to be fully loaded and stable before checking viewport + await page.waitForLoadState('domcontentloaded'); + await page.setViewportSize({ width: 320, height: 256 }); + console.log('scanning page') + const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); + const clientWidth = await page.evaluate(() => document.documentElement.clientWidth); + console.log('widths', scrollWidth, clientWidth) + + // Match local test: check without tolerance (don't allow any horizontal scroll) + if (scrollWidth > clientWidth) { + console.log('page is too wide!') + + findings.push({ + scannerType: 'viewport', + ruleId: 'horizontal-scroll', + url, + html: 'n/a', + problemShort: 'page requires horizontal scrolling at 320x256 viewport', + problemUrl: 'https://www.w3.org/WAI/WCAG21/Understanding/reflow.html', + solutionShort: 'ensure content is responsive and does not require horizontal scrolling at small viewport sizes', + solutionLong: `The page has a scroll width of ${scrollWidth}px but a client width of only ${clientWidth}px at 320x256 viewport, requiring horizontal scrolling. This violates WCAG 2.1 Level AA Success Criterion 1.4.10 (Reflow).` + }); + } } catch (e) { - // do something with the error + console.error('Error checking horizontal scroll:', e); } + await context.close(); await browser.close(); return findings;