Testing · Junior · Question 59 of 78

Why do Testing Library queries by role also improve accessibility?

Explanation

A <div onClick> instead of <button> has no button role, and such a test fails - prompting you to fix the markup.

Further reading

Problem with a question

Testing · Junior · question 59

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz