testing-library / testing-library/dom-testing-library
Ability to search for content of role="status"
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 474
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature you'd like:
The following component cannot be found by role+name:
<div role="status">loading...</div>
expect(await screen.findByRole('status', { name: /loading/ })); // Fails
If I use button as role this does work:
<div role="button">loading...</div>
expect(await screen.findByRole('button', { name: /loading/ })); // Succeeds
Suggested implementation:
/
Describe alternatives you've considered:
Searching for just the role does work but I could have multiple status messages and would like to specify the content:
expect(await screen.findByRole('status')); // Succeeds
Teachability, Documentation, Adoption, Migration Strategy:
The W3 documentation clearly allows this use case for the status role:
https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA22

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at screen.findByRole with role="status" and compare its role-only behavior with the failing role-plus-name example. Check the W3C ARIA22 guidance linked in the issue, then add regression coverage showing that a status element named "loading" can be found by role and name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- accessibility, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100