Testing · Junior · Question 59 of 78
Why do Testing Library queries by role also improve accessibility?
- ✓Correct answer: If a test can't find an element by role and name, a screen reader probably can't either
- 2Because they add ARIA attributes automatically
- 3Because they run axe checks
Explanation
A <div onClick> instead of <button> has no button role, and such a test fails - prompting you to fix the markup.