Using data-testid attributes in tests is an accessibility smell because users can't see or interact with test IDs. Role-based selectors (via Testing Library or Playwright) are superior because they mirror how real users interact with apps, catch inaccessible markup like clickable divs lacking semantic roles, and provide

7m read timeFrom tkdodo.eu
Post cover image
Table of contents
Testing LibraryAccessibilityExampleRole-based selectorsContinue Series
1 Comment

Sort: