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.
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
imgwith noaltattribute at all. - A form control with no accessible name.
- Text contrast below 4.5 to 1.
- Duplicate
idvalues that breakaria-labelledby. - ARIA that is invalid: a misspelt role,
aria-checkedon an element that cannot be checked,aria-hidden="true"on something focusable. - A page with no
langonhtml, or notitle.
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.
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.
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.
| Pair | Why | Cost |
|---|---|---|
| NVDA + Chrome or Firefox | Free, behaves much like JAWS, the default Windows test | Free |
| VoiceOver + Safari (macOS) | Built in on every Mac, catches WebKit-specific bugs | Free |
| VoiceOver + Safari (iOS) | The main mobile screen reader by far | Free |
| TalkBack + Chrome (Android) | The Android audience | Free |
| JAWS + Chrome | The most used desktop reader, often required by enterprise clients | Paid 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 each NVDA browse-mode command to what it does.
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, alabelelement), 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 showsname: ""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-schemeandforced-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.
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.
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>
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.
- Load the page. Is the page
titleannounced 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? - 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. - Landmarks. Press D or use the Rotor. Is there one
main? Are repeatednavregions labelled ("Primary", "Footer")? - 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.
- 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? - 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?
- 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?
- 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.
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 a new-feature accessibility check in the most efficient order.
- Tap the steps below in the right order.
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.
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).
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.
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.
- 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.