Skip to content

Add accessibility testing to CI#8

Merged
mbwatson merged 27 commits intostagecc:mainfrom
mbwatson:feature/ci-a11y-check
Mar 4, 2026
Merged

Add accessibility testing to CI#8
mbwatson merged 27 commits intostagecc:mainfrom
mbwatson:feature/ci-a11y-check

Conversation

@mbwatson
Copy link
Copy Markdown
Member

@mbwatson mbwatson commented Feb 23, 2026

Summary

Introduces automated accessibility auditing to the CI pipeline, targeting Section 508 / WCAG 2.0+2.1 Level AA compliance. The audit runs axe-core via Playwright against every page in the sitemap after each build. This PR also fixes all a11y violations surfaced by the new checks so the pipeline passes green.

What's new/changed

A11y test infrastructure (apps/site/a11y/)

  • Shared Playwright fixture (axe-test.ts): configures axe-core with WCAG 2.x A/AA tags and disables frame-tested (cross-origin iframes, like our YouTube embeds).
  • Test scripts: three run modes:
    • a11y:page: scan one or more URLs against a running dev server
    • a11y:smoke: build + test a curated set of key pages
    • a11y:full: build + test every page listed in the sitemap
  • Playwright config (playwright.config.ts): starts astro preview on port 4321, reuses an existing server when available.
  • README with usage, configuration, and exception guidance.

CI workflow (.github/workflows/ci.yaml)

  • Uploads the build artifact from the existing build job.
  • New a11y job (depends on build): installs deps, downloads the artifact, installs Playwright Chromium, and runs the full-site audit via node a11y/full.js.
  • node version uses the version specified in the new .nvmrc file

Supporting changes

  • @astrojs/sitemap added — generates sitemap xml files consumed by the full-site test runner.
    • also just good practice to have this
  • Sitemap link added to <head> in Base.astro.
  • an .nvmrc file, which specifies the Node dev version we'll be using, was added

A11y fixes

  • Color contrast — used design system colors (classes) in lieu of hard-coded colors in EventHeader, ArticleHeader, Figure, Video, SiteFooter.
  • Heading hierarchy — changed <h4> to <h2> in SiteFooter and FaqList to fix heading-level skips.
  • Link distinguishability — added text-underline class to breadcrumb links.
  • Missing alt text — added empty alt="" to decorative placeholder image on the homepage.
  • Broken links — corrected news/event list hrefs to use /updates/news/… and /updates/events/… paths; updated breadcrumb trails in Article and Event layouts to match.

How to validate

  • check CI: A full site scan should run on code coming in via PR, like this one!
  • How to test accessibility locally
    • ad-hoc page check: npm run a11y:page -w @bdc/site -- http://localhost:4321/resources/faqs
    • smoke test (key pages): npm run a11y:smoke -w @bdc/site
    • full site scan: npm run a11y:full -w @bdc/site

install astro sitemap

setup astro sitemap

wip

correct url, install/update deps
fix footer link contrast

`text-base` class applies `#71767A` text on the footer's `#F0F0F0` background.
this is ~4.1:1 contrast (fails 4.5:1 AA)

fix nav link contrast

USWDS styles the NavDropDownButton text with `color('base')` (`#71767A`) on white,
which has contrast  ~4.65:1
borderline, axe flags it, so we'll fix
@mbwatson mbwatson marked this pull request as draft February 23, 2026 21:25
@mbwatson mbwatson marked this pull request as ready for review February 23, 2026 21:27
@mbwatson mbwatson marked this pull request as draft February 23, 2026 21:42
@mbwatson
Copy link
Copy Markdown
Member Author

there are a few existing accessibility issues at this point (see the failed check!), so i've switch this PR to draft until those are remedied. this way the app starts at 💯

@mbwatson mbwatson marked this pull request as ready for review February 24, 2026 17:23
@mbwatson mbwatson requested a review from suejinkim20 February 24, 2026 17:24
@mbwatson mbwatson force-pushed the feature/ci-a11y-check branch from 2182db7 to f3a73d0 Compare March 4, 2026 13:47
@mbwatson
Copy link
Copy Markdown
Member Author

mbwatson commented Mar 4, 2026

Just linking to documentation related to the Node version bump and peer dep resolution issues we were seeing: the npm docs on package-lock.json covers the "peer" field

@mbwatson mbwatson merged commit 8a6988b into stagecc:main Mar 4, 2026
4 checks passed
@mbwatson mbwatson deleted the feature/ci-a11y-check branch March 5, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants