Notes
WCAG
The main standard is WCAG, the Web Content Accessibility Guidelines from the W3C, currently version two point two. Its four principles spell POUR. Perceivable: text alternatives, contrast, captions. Operable: everything works by keyboard, users have enough time, nothing flashes dangerously. Understandable: clear labels and error messages, predictable behaviour. Robust: works with assistive technology. Success criteria have levels A, AA and AAA; most laws and policies target AA.
- Web Content Accessibility Guidelines (W3C), now 2.2
- Perceivable: alt text, contrast, captions
- Operable: keyboard, time, no seizures, navigation
- Understandable: labels, errors, predictable
- Robust: works with assistive tech (valid roles, names)
- most laws target level AA
Automated scans
Axe core is the most widely used accessibility rules engine, and the axe Playwright package runs it inside a test. Open the page and wait until it has rendered, because ShopRung builds pages with JavaScript. Then build an axe scan limited to WCAG A and AA rules, analyse, and expect no violations. Each violation lists the rule, its impact, the elements involved and how to fix them.
import AxeBuilder from
"@axe-core/playwright";
await page.goto("/#/login");
await page.locator("main h1")
.waitFor();
const r = await new AxeBuilder(
{ page }).withTags(["wcag2a",
"wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(r.violations).toEqual([]); A real finding
We scanned three ShopRung pages. Login: no violations. Product: no violations. Home: twelve serious violations of one rule, label content name mismatch, one for each add to cart button. The visible text says add to cart, but the accessible name, from the aria label, is add clean code notebook to cart, and the visible words are not contained in it. This is the same button that surprised us in the locators episode.
login violations: none
product violations: none
home label-content-name-
mismatch (serious) x12
button[data-add="1"]
visible text: "Add to cart"
accessible name: "Add Clean
Code Notebook to cart"
"Text inside the element is not
included in the accessible name" Why it matters
Why does it matter? It breaks WCAG's label in name rule. A person using voice control looks at the screen and says click add to cart. Their software matches the spoken words against accessible names, and add clean code notebook to cart does not contain the phrase. A fix keeps the visible words inside the name, for example add to cart, clean code notebook, or keeps the visible text and adds a visually hidden product name after it.
- a voice control user says: "click Add to cart"
- the name must CONTAIN the visible words to match
- fix options: name "Add to cart: Clean Code Notebook" or visible text + visually hidden product name
ARIA snapshots
Playwright's ARIA snapshots capture the accessibility tree as readable YAML. This is ShopRung's real header: a navigation named main with links for products, cart zero, orders and log in, and a search landmark with a labelled search box and a search button. To match aria snapshot asserts this structure, so if someone removes a label or turns a link into an unlabelled icon, the test fails with a clear diff.
- navigation "Main": - link "Products" - link "Cart 0" - link "Orders" - link "Log in" - search: - searchbox "Search products" - button "Search" expect(nav).toMatchAriaSnapshot( `...`)
Keyboard
Keyboard users move with tab and activate with enter or space. Tests can press tab and check which element has focus. On ShopRung, tabbing from the page went to the category filter, then each product's link and its add button in reading order, which is logical. Also check that focus is always visible, nothing traps focus, enter and space activate controls, and escape closes dialogs.
await page.keyboard.press("Tab");
expect(page.locator(":focus"))
ShopRung tab order (real):
category → product link →
its Add button → next
product ... (logical)
check: visible focus, no traps,
Enter/Space activate,
Esc closes dialogs Limits of automation
Automated scanners catch a useful share of issues, such as missing labels, low contrast and invalid ARIA, but many problems need judgment. Is the alt text meaningful, or just image? Is the reading order sensible? Do error messages help? Does the page work at two hundred or four hundred percent zoom? Can someone complete checkout with a screen reader? Treat automated results as a floor, not a certificate.
- is the alt text MEANINGFUL?
- is the reading order sensible?
- do error messages help?
- does it work at 200-400% zoom?
- is the flow usable with a screen reader?
- do custom widgets behave like their role?
- automated = a floor, not a certificate
Manual testing
A practical manual routine. Complete the main journey with the keyboard only. Repeat it with a screen reader: NVDA on Windows, VoiceOver on Mac and iPhone, TalkBack on Android. Zoom to two hundred and four hundred percent. Check that colour is never the only way meaning is shown, like red for errors without text. Best of all, include people with disabilities in usability sessions.
- keyboard only: full journey
- screen reader: NVDA (Windows), VoiceOver (macOS, iOS), TalkBack (Android)
- zoom 200% and 400%, and text spacing
- colour: contrast, not colour alone for meaning
- best: sessions with disabled users
Common mistakes
Mistakes. Believing a clean axe scan means the product is accessible. Scanning before a JavaScript page has rendered, which reports nothing. Disabling rules to get a green build. Adding aria labels everywhere: as ShopRung showed, an aria label can create a problem, and the common advice is that no ARIA is better than bad ARIA. And leaving accessibility to the end, when fixes are most expensive.
- "axe passed, so we are accessible"
- scanning before the page has rendered
- disabling rules to go green
- aria-label everywhere (no ARIA is better than bad ARIA)
- testing only at the end
Say it like this
In the interview: I test against WCAG two point two AA. In CI, axe scans key pages after they render, ARIA snapshots protect key components, and tests cover keyboard navigation. Manually, I run keyboard only and screen reader journeys and check zoom and contrast. Automation is a floor, not a certificate; for example, axe flagged our add to cart buttons for a label in name problem that affects voice control users.
- "Against WCAG 2.2 AA. In CI: axe scans of key pages after render, ARIA snapshots of key
- components, keyboard tests.
- Manually: keyboard-only and screen reader journeys, zoom, contrast. Automation is a floor; e.g. axe flagged our Add to cart buttons for label-in-name."