Skip to content

Lesson 31 of 52Accessibility in depth

Testing with Screen Readers and Automated Tools

Combine axe, browser accessibility tools and real screen readers into a test routine that finds the bugs automation cannot, then lock it into CI.

16 min read0/4 questions

Your team ships a new checkout. Lighthouse scores it 100 for accessibility, and two weeks later a support ticket arrives from a blind customer who could not pay. The card number field was announced as "edit text" with no label, the error appeared in red with no announcement, and the "Pay" button was a div that the screen reader skipped. None of that was hidden: a five-minute pass with a screen reader would have caught all three. This lesson turns testing into a routine you can run on every feature: what automated tools are good for, how to drive VoiceOver and NVDA well enough to test, which browser panels show you what a screen reader will hear, and how to lock the basics into CI.

What automated tools can and cannot see

Accessibility Basics gave you a ten-minute check. This lesson goes deeper, and the first thing to get straight is what automation is for.

Tools such as axe-core (inside axe DevTools, Lighthouse and many test runners), WAVE and Lighthouse run rules against the DOM and computed styles. They are excellent at problems with a yes or no answer:

  • An img with no alt attribute at all.
  • A form control with no accessible name.
  • Text contrast below 4.5 to 1.
  • Duplicate id values that break aria-labelledby.
  • ARIA that is invalid: a misspelt role, aria-checked on an element that cannot be checked, aria-hidden="true" on something focusable.
  • A page with no lang on html, or no title.

What they cannot judge is meaning. A tool sees that alt="image123.jpg" exists, not that it is useless. It sees that headings exist, not that the outline makes sense. It cannot tell whether focus lands somewhere sensible after a dialog closes, whether a toast is ever announced, or whether a custom dropdown can be used with arrow keys. Studies by accessibility firms put automated coverage somewhere between a third and a half of real issues, depending on whether you count by WCAG criterion or by volume (a few issues, like contrast, are extremely common and easy to detect). Treat a clean scan as "the boring bugs are gone", never as "accessible".

How a screen reader gets its information

To test well you need to know what you are testing. A screen reader never reads your HTML. It reads the accessibility tree through an operating system API.

From your markup to speech
  1. DOM and CSSyour elements, attributes, display and visibility
  2. Accessibility treerole, name, description, state per node
  3. Platform APIUIA and IA2 on Windows, NSAccessibility on macOS
  4. Screen readerbuilds its own virtual buffer, adds key commands
  5. Outputspeech and braille

The browser computes the tree. display: none and hidden remove nodes. aria-label changes a name. A div with a click handler is just a generic node.

1/4

The practical point: if the accessibility tree is right, most screen readers will do something reasonable. If it is wrong, no screen reader can fix it. So you test in two layers. First inspect the tree in DevTools, then listen to confirm the experience.

Which screen readers and browsers to test

The WebAIM screen reader survey is the best public data. The most recent one (run in mid 2026) found that on desktop, JAWS was the primary screen reader for about 55 percent of respondents, NVDA for about 33 percent and VoiceOver for under 7 percent. On mobile, VoiceOver on iPhone dominated, with TalkBack on Android a clear second. The top pairings were JAWS with Chrome, NVDA with Chrome, JAWS with Edge and NVDA with Firefox.

PairWhyCost
NVDA + Chrome or FirefoxFree, behaves much like JAWS, the default Windows testFree
VoiceOver + Safari (macOS)Built in on every Mac, catches WebKit-specific bugsFree
VoiceOver + Safari (iOS)The main mobile screen reader by farFree
TalkBack + Chrome (Android)The Android audienceFree
JAWS + ChromeThe most used desktop reader, often required by enterprise clientsPaid licence (a time-limited demo mode exists)

Two rules: pair each screen reader with the browser its users actually use (VoiceOver with Chrome is a rare combination), and do not test only on the platform you develop on. A team of Mac developers who only test VoiceOver is testing for well under a tenth of desktop screen reader users.

VoiceOver quick start (macOS and iOS)

  • Cmd+F5 turns VoiceOver on and off. The first run offers a tutorial; do it once.
  • The VO keys are Ctrl+Option (or Caps Lock, if you set it). Every command below starts with them.
  • VO+Right and VO+Left move to the next and previous item. VO+A reads from here. Ctrl stops speech.
  • VO+Space activates the current item, like a click.
  • VO+U opens the Rotor: a menu of headings, links, form controls and landmarks. Left and right arrows switch lists, up and down move inside one, Enter jumps. This is the fastest way to see your heading outline as a user does.
  • VO+Cmd+H jumps to the next heading.
  • In Safari, Tab only reaches form controls by default. Turn on "Press Tab to highlight each item on a webpage" in Safari's advanced settings, or links will seem unreachable when they are not.

On iOS, turn VoiceOver on in Settings, then Accessibility (set the triple-click shortcut so you can switch it off quickly). Swipe right and left to move, double-tap to activate, and rotate two fingers to change the rotor setting before swiping up and down by headings or links. Testing on a real phone catches problems with sticky footers, hidden-but-focusable menus and tap targets that the desktop never shows.

NVDA quick start (Windows)

NVDA is free from nvaccess.org. The NVDA key is Insert (or Caps Lock with the laptop layout).

The concept that confuses every new tester is browse mode versus focus mode:

  • In browse mode NVDA reads its virtual buffer. Single letters are navigation commands: H next heading (1 to 6 for a level), D next landmark, K next link, F next form field, B next button, T next table, and Ctrl+Alt+arrows move between table cells. Down arrow reads line by line.
  • In focus mode keys go straight to the page, so you can type in a text field or use arrow keys inside a widget. NVDA switches automatically when you Tab into or click a field, and plays a sound. NVDA+Space switches by hand. Escape goes back to browse mode.

This is why a custom widget that handles arrow keys may "not work" for screen reader users: in browse mode, NVDA swallows the arrows. Correct roles (a textbox, a tablist, a listbox) are what tell NVDA to switch to focus mode. It is also why role="application" is almost always a mistake: it forces focus mode for a whole region and removes the user's reading commands.

Two tools make NVDA testing far easier. NVDA+F7 opens the Elements List, showing every link, heading, form field, button and landmark with its name. Scanning it for "unlabelled" or "link link link" takes seconds. And Speech Viewer (NVDA menu, Tools) shows every spoken phrase as text, so you can test with the sound off, take screenshots for bug reports, and read exactly what was announced.

Match the pairs0/5 matched

Match each NVDA browse-mode command to what it does.

Choose an item, then its match on the other side.

Inspecting the accessibility tree in the browser

Before you listen, look. Every major browser shows the tree.

  • Chrome and Edge DevTools: in the Elements panel, the Accessibility pane shows the selected node's computed role, name, the source of that name (contents, aria-label, a label element), and its states. Tick "Enable full-page accessibility tree" and a button in the Elements panel lets you switch the whole DOM view to the tree. A button that shows name: "" here will be announced as just "button".
  • Firefox Accessibility Inspector: a separate panel with the full tree, a "Check for issues" menu (contrast, keyboard, text labels) and a "Show Tabbing Order" overlay that numbers every focus stop on the page. That overlay finds focus order problems in seconds.
  • Chrome's Rendering tab (from the three-dot menu, More tools): emulate vision deficiencies such as blurred vision and several types of colour blindness, emulate prefers-reduced-motion: reduce, prefers-color-scheme and forced-colors: active. The forced colours check matters: Windows contrast themes remove your backgrounds and shadows, and any meaning carried by them disappears.

The preview below is a small audit you can paste into any page's console. It prints the heading outline, landmarks, and every control with its approximate name. It ignores some name rules (such as title and CSS-generated content), so treat it as a quick smoke test and use the browser's Accessibility pane for the real computed name.

HTML & CSS
<style> body { font-size: 14px; } pre { background: #111; color: #e6e6e6; padding: 10px; white-space: pre-wrap; font-size: 12px; } .page { border: 1px dashed #999; padding: 8px; margin-bottom: 8px; }</style><div class="page"> <header><h1>Checkout</h1></header> <main> <h3>Payment</h3> <input id="card" placeholder="Card number"> <label for="name">Name on card</label> <input id="name"> <div class="pay" onclick="alert('paid')">Pay</div> <button><svg width="12" height="12" aria-hidden="true"><rect width="12" height="12"/></svg></button> <a href="#">Click here</a> </main></div><button id="run">Run audit</button><pre id="out"></pre><script> function nameOf(el) { const by = el.getAttribute("aria-labelledby"); if (by) return by.split(/\s+/).map((id) => document.getElementById(id)?.textContent.trim() || "").join(" "); if (el.getAttribute("aria-label")) return el.getAttribute("aria-label"); if (el.labels && el.labels.length) return [...el.labels].map((l) => l.textContent.trim()).join(" "); if (el.matches("input, textarea, select")) return ""; return el.textContent.trim(); } function audit() { const lines = ["HEADINGS"]; let last = 0; document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((h) => { const level = Number(h.tagName[1]); const skip = last && level > last + 1 ? " <- skipped a level" : ""; lines.push(" ".repeat(level - 1) + "h" + level + " " + h.textContent.trim() + skip); last = level; }); lines.push("", "LANDMARKS"); document.querySelectorAll("header, nav, main, aside, footer, [role=region], form[aria-label]").forEach((el) => lines.push(" " + el.tagName.toLowerCase())); lines.push("", "CONTROLS"); document.querySelectorAll("a[href], button, input, select, textarea, [onclick], [tabindex]").forEach((el) => { if (el.closest("#run, #out") || el.id === "run") return; const name = nameOf(el); const native = el.matches("a[href], button, input, select, textarea"); let note = name ? '"' + name + '"' : "NO NAME"; if (!native) note += " <- not a real control, not focusable"; if (/^(click here|read more|more)$/i.test(name)) note += " <- vague link text"; lines.push(" " + el.tagName.toLowerCase() + (el.id ? "#" + el.id : "") + ": " + note); }); document.getElementById("out").textContent = lines.join("\n"); } document.getElementById("run").addEventListener("click", audit);</script>

Preview

Run it and read the report: the heading jumps from h1 to h3, the card field relies on a placeholder (which is not a label), the Pay "button" is a div, the icon button has no name, and the link says "Click here". Fix the markup in the editor (add a label, use a real button, add aria-label="Delete card" to the icon button, change the h3 to h2) and run it again until it is clean.

Predict the outputHTML

With a screen reader on, the user tabs to this button. Roughly what is announced? Type the name the user hears.

<button aria-label="Close" title="Dismiss dialog">
<svg aria-hidden="true">...</svg>
X
</button>
Need a nudge? Hints walk you through it.

A 15-minute screen reader test script

Run this on every new page or significant feature, with one Windows pair and one Apple pair. Write down what you hear, not what you expected.

  1. Load the page. Is the page title announced and does it say where you are ("Checkout, step 2 of 3, Shop")? On a single-page app, is anything announced after a route change?
  2. Headings. Open the Rotor or press H repeatedly. Do the headings alone tell you the structure? One h1, no skipped levels, no bold paragraphs pretending to be headings.
  3. Landmarks. Press D or use the Rotor. Is there one main? Are repeated nav regions labelled ("Primary", "Footer")?
  4. Every control. Tab through. Each stop must have a sensible name, the right role and its state: "Remember me, checkbox, not checked", "Menu, button, collapsed". Missing state is the most common custom-widget bug.
  5. Forms. Submit with errors. Is the error announced or does focus move to it? Is each error tied to its field so it is read when you return to the field (aria-describedby)? Is anything signalled by colour alone?
  6. Dynamic updates. Add to basket, save, filter a list. Is the result announced through a live region? Is a loading state announced, and then the result?
  7. Dialogs and menus. Does focus move in when they open, stay inside a modal, and return to the trigger when they close? Can Escape close them?
  8. Images and media. Listen to the alt text in context. Is it useful, too long, or a file name? Are decorative images skipped?

The live region step is the one teams get wrong most. A live region must already be in the DOM, and empty, before you put text into it. Creating the element and its message in one go is often not announced at all. Hiding the empty region with display: none causes the same bug, because hidden elements are not in the accessibility tree, so collapse its padding instead. Turn on a screen reader and compare the two buttons below.

HTML & CSS
<style> .row { display: flex; gap: 8px; margin-bottom: 12px; } .msg { padding: 8px 12px; background: #e8f5e9; border-left: 4px solid #2e7d32; margin: 6px 0; } .msg:empty { padding: 0; border: 0; }</style><div class="row"> <button id="good">Save (region exists first)</button> <button id="bad">Save (region created with message)</button></div><div id="status" role="status" class="msg"></div><div id="later"></div><script> let n = 0; document.getElementById("good").addEventListener("click", () => { n += 1; document.getElementById("status").textContent = "Draft saved (" + n + ")"; }); document.getElementById("bad").addEventListener("click", () => { n += 1; const box = document.createElement("div"); box.setAttribute("role", "status"); box.className = "msg"; box.textContent = "Draft saved (" + n + ")"; document.getElementById("later").replaceChildren(box); });</script>

Preview

Both look identical. With VoiceOver or NVDA running, the first is announced reliably, and the second may or may not be, depending on the screen reader and browser. That is the kind of bug only listening finds.

Put it in order5 steps

Put a new-feature accessibility check in the most efficient order.

  1. Tap the steps below in the right order.
Need a nudge? A hint shows where it starts.

Automating the checks in CI

Manual testing finds the hard bugs. Automation stops the easy ones coming back. A typical setup has four layers.

Lint in the editor. For React code, eslint-plugin-jsx-a11y flags onClick on a div without a key handler, images without alt, and invalid ARIA as you type.

eslint.config.js
import jsxA11y from "eslint-plugin-jsx-a11y";
 
export default [
  jsxA11y.flatConfigs.recommended,
];

axe in end-to-end tests. @axe-core/playwright runs the full axe rule set on a real rendered page, including states you only reach by clicking (an open dialog, a form with errors).

tests/checkout.a11y.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
 
test("checkout has no detectable a11y violations", async ({ page }) => {
  await page.goto("/checkout");
  await page.getByRole("button", { name: "Pay now" }).click(); // show the errors
 
  const results = await new AxeBuilder({ page })
    .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"])
    .exclude("#third-party-chat")
    .analyze();
 
  expect(results.violations).toEqual([]);
});

Role-based locators. Playwright's getByRole("button", { name: "Pay now" }) finds elements through the accessibility tree. If someone turns the button into a div, or removes its name, the test fails. Your ordinary functional tests become accessibility tests for free, which is why many teams ban CSS selectors in tests. Playwright's ARIA snapshots (toMatchAriaSnapshot) go further and assert a whole region's tree of roles and names.

await expect(page.getByRole("alert")).toHaveText("Card number is required");
await expect(page.getByRole("textbox", { name: "Card number" })).toBeFocused();

Lighthouse CI can fail a build if the accessibility category drops below a budget. It is a smoke alarm, not a test suite.

Two cautions. Do not disable rules to get green; when you must exclude a third-party widget, leave a comment and a ticket. And on an existing product, start by failing only on new violations (record a baseline and compare), or the first run will produce hundreds of errors and the check will be switched off within a week.

Quick check
Your CI runs axe on every page and passes. Which bug is it most likely to miss?
Need a nudge? A hint rules out a wrong answer.

Writing an accessibility bug report

A vague report ("the form is not accessible") gets closed. A useful one is reproducible and tied to a standard:

Title: Card number error is not announced (WCAG 3.3.1, 4.1.3)
 
Environment: NVDA 2026.x + Chrome 14x, Windows 11. Also VoiceOver + Safari 26, macOS.
Steps:
  1. Go to /checkout, step 2
  2. Leave "Card number" empty, press "Pay now"
Expected: focus moves to the error summary, or the error is announced,
          and "Card number, edit, invalid entry, Card number is required" on return to the field.
Actual:   red text appears, nothing is announced. Field announced as "edit text", no name.
Speech Viewer output attached. Impact: blind users cannot complete payment (blocker).
Suggested fix: add <label for="card">, aria-describedby="card-error", aria-invalid="true".

Note the parts: the WCAG success criterion, the exact assistive technology and browser versions (behaviour differs between them), numbered steps, expected versus actual in the user's words, the impact, and a suggested fix. Severity should follow impact on the task, not the number of rules broken: one unlabelled Pay button outranks fifty decorative images with redundant alt text.

Key terms
axe-core
An open source accessibility rules engine used by axe DevTools, Lighthouse and test runners such as @axe-core/playwright.
browse mode
Windows screen reader mode that reads a virtual copy of the page, where single letters jump between headings, links and fields.
focus mode
Screen reader mode that passes keys to the page so users can type in fields and use widget keys.
Rotor
VoiceOver's menu (VO+U on macOS, a two-finger twist on iOS) for jumping by headings, links, landmarks and form controls.
Elements List
NVDA's dialog (NVDA+F7) listing every link, heading, field, button and landmark on the page with its name.
live region
An element such as role=status whose content changes are announced; it must exist before the text is added.
role-based locator
A test query like getByRole that finds elements through the accessibility tree, so tests fail when roles or names break.