Accessibility for testing
full guide
Testers are often the last check before a feature reaches users. That makes you well placed to catch accessibility issues, but you can’t test accessibility in at the end. This guide helps you test for accessibility and make it part of your team’s process. It is a starting point.
How to test for accessibility
chapter 1
Getting started
Must know: Start with the keyboard
Put your mouse away and try to use the page with only a keyboard. It is the quickest test that finds the most issues.
Move through the page with Tab and Shift+Tab. Use Enter and Space to activate links and buttons, and the arrow keys in menus, tabs and radio buttons. Escape should close dialogs and menus.
Check these things as you go:
- Can you reach and use every link, button and form field?
- Can you always see where the focus is?
- Is the focus never hidden behind a sticky header, a cookie banner or a chat button?
- Does the focus move in a logical order?
- Can you get out of every component, like a dialog, a video player or a map, without using a mouse?
- When a dialog closes, does the focus go back to where you were?
Fails
The focused link scrolls under the header, so you can’t see where you are.
Passes
The page scrolls so the focused link stays below the header.
Watch out
On a Mac, Safari skips links when you press Tab. Turn on “Press Tab to highlight each item on a webpage” in Safari’s settings first.
Know what automated tools can and can’t do
Automated tools find part of the issues. A clean report doesn’t mean a page is accessible.
Tools are good at things a computer can measure: an image without an alt attribute, a form field without a label, text with too little contrast, a duplicate id.
They can’t judge whether the alt text describes the image, whether the focus order makes sense, whether an error message helps, or whether a custom component works with a screen reader. That still takes a person.
Use a tool first to clear the obvious issues, then test the rest by hand.
Useful links
- axe (opens external website), an accessibility testing engine with a browser extension.
- Accessibility Insights (opens external website), a browser extension with automated checks and guided manual tests.
- WAVE (opens external website), a browser extension that shows issues on the page itself.
- Selecting web accessibility evaluation tools, by the W3C (opens external website)
Use a quick check to get a first impression
The W3C’s Easy Checks show in an hour or so where a page stands.
Easy Checks walk you through a page title, images, headings, contrast, zoom, the keyboard, forms, moving content and multimedia. Each check explains what to look for and why it matters.
It isn’t a full test against WCAG, but it is a good way to learn, and to see quickly whether a page has big problems.
Screen readers
Learn the basics of one screen reader
You don’t need to be an expert. A few commands are enough to find many issues.
NVDA on Windows is free, and VoiceOver is built into macOS and iOS. Pick one and learn to:
- read the page from top to bottom;
- jump from heading to heading, and bring up a list of headings, links and landmarks;
- move through a form and fill it in.
Screen reader users don’t read every word. They scan by headings and links, just like sighted users scan a page. If that doesn’t work, the page is hard to use.
Keep in mind that screen reader users use their screen reader every day, with their own settings. You use it to find issues, not to judge how easy a page is for them.
Useful links
Check what every control says
A screen reader announces a name, a role and sometimes a state for every control. Listen for all three:
- Name: does an icon button say what it does?
- Role: is a button announced as a button and a link as a link?
- State: is a menu announced as expanded or collapsed, and a checkbox as checked or not checked?
Custom components, like tabs, accordions and comboboxes, often get this wrong. Test them extra carefully.
Fails
“Button.”
Passes
“Search, button.”
Check that changes are announced
When something changes on the page without the focus moving, a screen reader user may miss it. Think of “Added to your cart”, “12 results” after filtering, or “Saved”.
Trigger these messages with a screen reader on, and check that you hear them, without the focus jumping away from where you are.
Fails
The list changes, but you hear nothing.
Passes
You hear “12 results”, and the focus stays on the filter.
Zoom and layout
Zoom in to 200% and 400%
Use the browser zoom on a desktop browser window of 1280 pixels wide.
- At 200%, all text and controls should still be visible and usable. Nothing should get cut off or overlap.
- At 400%, the page is as wide as 320 CSS pixels. All content should fit in one column, so you only scroll up and down. Maps, data tables and diagrams may scroll sideways.
Watch out for sticky headers and banners: at 400% they can cover most of the screen.
Fails
The sidebar stays next to the content, so you scroll sideways to read every line.
Passes
The sidebar moves below the content, and every line fits on the screen.
Increase the text spacing
Some people increase the space between lines, words and letters to read more easily. WCAG tests this with a line height of 1.5 times the font size, spacing after paragraphs of 2 times, letter spacing of 0.12 times and word spacing of 0.16 times the font size.
Apply these values with a bookmarklet or browser extension, and look for text that gets cut off or overlaps, especially in buttons, cards, tabs and menus.
Turn your phone sideways
Some people have their phone or tablet mounted in one position, for example on a wheelchair. Check that the page works in both portrait and landscape, and doesn’t ask you to rotate your device.
Colour and contrast
Measure the contrast
Text needs a contrast ratio of at least 4.5:1 with its background. Large text, from 24 pixels, or 18.66 pixels in bold, needs at least 3:1.
Icons, the borders of form fields and the focus indicator need at least 3:1 too.
Automated tools measure most text, but they miss text on images and gradients, and states like hover and focus. Measure those with a colour picker.
Check that colour isn’t the only clue
Turn on greyscale in your operating system or with a browser extension. Can you still tell which field has an error, which link is a link, which tab is selected and what each line in a chart means?
Fails
Only the border turns red. In greyscale, nothing shows there is an error.
Passes
An error icon and the text “Enter your email address.” are still there in greyscale.
Content and structure
Check headings, page titles and link texts
Every page needs a unique title that says what is on it. Headings should describe the content below them and follow a logical order. Link texts should make sense on their own, or together with the sentence around them.
These bookmarklets show the headings or the links of any page, the way a screen reader user can bring them up. Drag them to the bookmarks bar in your browser to install them. Clicking them on this page does nothing: they work on the page you want to check. Using a keyboard? Copy the link address and save it as a new bookmark.
Check images, video and audio
A tool can tell you that an image has alt text, but not whether it is any good. Read the alt text and ask: does it give the same information as the image? Decorative images should have an empty alt text, so screen readers skip them.
Videos need captions, and video and audio need a transcript. Check that the captions are correct and in sync, not just that they are there.
Fails
“IMG_2041.jpg”
Passes
“Red rain jacket with a hood, seen from the front.”
Forms and interaction
Fill in every form wrongly
Most issues in forms only show up when something goes wrong.
Leave required fields empty, enter a date in the wrong format and submit. Then check:
- Does every field have a visible label, and does a screen reader read the same label?
- Is the error shown in text, not only with a red border?
- Does the error message say how to fix it?
- Can a keyboard and screen reader user find the errors?
- Is everything you entered still there?
Fails
“Invalid input.”
Passes
“Enter the date as day, month and year, for example 21 11 1990.”
Don’t forget the newer WCAG 2.2 criteria
WCAG 2.2 added a few criteria that older checklists and tools miss:
- Dragging: everything you can drag, like a slider or a sortable list, also works with a single click or tap.
- Target size: controls are at least 24 by 24 CSS pixels, or have enough space around them.
- Redundant entry: you don’t have to enter the same information twice in one process, like your address in a checkout.
- Logging in: you can paste a password and use a password manager, and you don’t have to solve a puzzle.
Useful links
- Understanding Success Criterion 2.5.7: Dragging Movements (opens external website)
- Understanding Success Criterion 2.5.8: Target Size (Minimum) (opens external website)
- Understanding Success Criterion 3.3.7: Redundant Entry (opens external website)
- Understanding Success Criterion 3.3.8: Accessible Authentication (Minimum) (opens external website)
Motion and time
Check moving content and time limits
Carousels, animations and videos that start by themselves and last longer than five seconds need a way to pause or stop them. Check that you can reach that button with a keyboard.
When a session or a form has a time limit, you should get a warning and a chance to extend it.
Fails
You’re logged out without a warning, and what you entered is gone.
Passes
A warning appears 2 minutes before, and you can extend the session with one button.
Making accessibility part of your testing
chapter 2
Accessibility issues are cheapest to fix before anything is built. Join refinements, ask how a new component works with a keyboard and a screen reader, and help write acceptance criteria that you can test.
Test against WCAG 2.2 level AA. That is what most laws and the European standard EN 301 549 come down to. The guide for product managers explains which law refers to which version.
Must know: Add accessibility to the acceptance criteria
If accessibility isn’t in the requirements, it is hard to reject a feature for it.
Work with your product manager to add testable criteria to every user story. For a sign-up form, for example:
- Every field has a visible label.
- Error messages say what went wrong and how to fix it.
- You can complete the form with only a keyboard.
- The focus is always visible.
What applies to every feature, like contrast and keyboard access, belongs in the Definition of Done. Then you test it every time, not only when someone remembers.
Run automated checks in your pipeline
Add an accessibility scan to your end-to-end tests, so a new issue fails the build before it reaches users. Scan pages in the states people see them: with a menu open, a dialog shown and error messages visible.
Fix the existing issues first, or the reports become noise that everyone ignores.
Don’t
await page.goto('/checkout');
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);Do
await page.goto('/checkout');
let results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
// Submit the empty form, then scan again with the error messages visible
await page.getByRole('button', { name: 'Pay' }).click();
results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);Useful links
- Accessibility testing, in the Playwright documentation (opens external website)
- axe (opens external website), whose engine axe-core also works with Cypress, Selenium and other test frameworks.
Do a short manual test every release
Not everything fits in an automated test. Before each release, test the new and changed parts with:
- only a keyboard;
- 400% zoom;
- a screen reader, for the main tasks.
Test complete tasks, like logging in, searching or ordering, not just separate pages. An issue in one step can block the whole task.
Useful links
Write bug reports that get fixed
A developer who doesn’t know WCAG by heart can’t do much with a number alone. A good report has:
- where it happens, and the steps to reproduce it;
- what you expected, and what happened;
- which browser and assistive technology you used, like NVDA with Firefox;
- the WCAG criterion;
- who is affected, and how badly;
- if you can, a suggestion for a fix.
Don’t
“Search field fails WCAG 1.4.3.”
Do
“The grey placeholder text in the search field has a contrast of 2.8:1 against the white background. WCAG 1.4.3 requires at least 4.5:1. People with low vision may not be able to read it. Make the text darker, for example the same colour as the body text.”
Useful links
Know when to call in a specialist
Your tests catch many issues during development. For an accessibility statement or a legal requirement, you need a full audit against all WCAG criteria, done with a method like WCAG-EM. That is a job for an accessibility specialist.
And no test replaces research with disabled people. They find problems that a checklist doesn’t.