New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
Half my tests grab a button with a test id, so I have no idea what a screen reader actually announces for it.
What you'll have at the end
The same test suite rewritten to query only by role, name and label text
You need
A component test suite already wired to jsdom and Testing Library, with at least one green test that finds some of its elements by a test id.
Not covered
Firing realistic clicks and keystrokes inside a test, or listening to your app with a real screen reader running; this recipe only changes which query finds each element.
Swap fireEvent for user-event in tests
once every query in the suite finds the real element, swapping the raw event helper for one that fires the real key and pointer events a browser sends is the next thing worth doing
What does your app sound like to a screen reader user?
for confirming what a real screen reader actually announces, past what an automated role-and-name match alone can prove
Checked 25 Aug 2026
Part of the Vitest Testing Framework cookbook