Write a Screen-Reader Test Script

You can now read the choir’s pages with VoiceOver or NVDA, and you’ve found the rehearsal schedule the way Tomás would, by headings and landmarks. But a screen reader talks fast, and once a page is read, what you heard is gone. When Marjorie asks whether the Concerts page works for Tomás, “it sounded fine” isn’t an answer she can act on.

In this lesson, you’ll write a test script for the Concerts page, run it, and record what each step should announce next to what you heard. You’ll also learn to tell a problem in the page from a quirk of one screen reader. Start by deciding what to listen for.

Write Down What Each Step Should Announce

Write your expectations down before you press a key, or whatever the screen reader says starts to sound right. Every element exposes up to four things, the same four the Accessibility pane shows:

  • Role: What kind of thing it is, such as a button, a link, or a table
  • Name: What it’s called, the accessible name you’ve been fixing
  • State: What’s true of it now, such as expanded, checked, or invalid
  • Description: Extra help attached with aria-describedby, like the sign-up form’s email hint

A test script is a short list of steps for one page, with keys to press in each screen reader and what should be announced, in those four terms.

Expectations come from what the page means to show, not from what a screen reader happens to say. Here’s a model script for the Concerts page. Copy it into a notes file you’ll keep for the site audit. VoiceOver’s keys start with its modifier, Ctrl+Option, and the NVDA key is Ins by default:

Step VoiceOver NVDA Expect
1. Landmarks Ctrl+Option+U, Landmarks Ins+F7, Landmarks Banner, navigation, main, and content info
2. Headings Ctrl+Option+Cmd+H, repeated H, repeated Level 1 “Spring Concert: Songs of the World”, then level 2 Program, Dates, Tickets, and “Singing in the concert?”
3. Dates table Ctrl+Option+Cmd+T, Ctrl+Option+Shift+Down, Ctrl+Option+Down to the Saturday row, Ctrl+Option+Right twice, Ctrl+Option+C T, Ctrl+Alt+Down to the Saturday row, Ctrl+Alt+Right twice A named table. St. Anne’s Church comes with its column header, Venue, and its row’s date
4. Ticket prices Ctrl+Option+Cmd+J, Ctrl+Option+Space, Esc; if still open, Ctrl+Option+Right to Close, Ctrl+Option+Space B, Enter, Esc; if still open, B to Close, Enter A button named “Ticket prices” opens a modal dialog named “Ticket prices”, with focus on the link “Getting to the venues”. Esc may not close it. “Close” does, returning you to Ticket prices
5. Get tickets Ctrl+Option+Cmd+J B A button named “Get tickets”
6. Links Ctrl+Option+Cmd+L, repeated K, repeated A nav link named “Concerts”, marked as the current page. Later, a link named “Sign up for the spring concert”

Concerts has one nav. A page with two <nav> elements names each with aria-label, or aria-labelledby pointing at a visible heading, so the landmark list tells them apart. The name needn’t repeat “navigation”.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.