testing-library / testing-library/dom-testing-library

Support abstract roles

Open
#1,282 9 comments 0 reactions 0 assignees View on GitHub

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:

It would be useful if we could, for example, get all inputs with getAllByRole('input').
This seems to be one of the abstract roles, and as far as I can tell, these are not supported currently:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role

Expected result is that <input type="text"> would have both textbox and input roles (as input is a superclass of textbox).

This would make testing a lot more flexible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by locating the role-query and accessible-role logic and its existing role tests; completion should make getAllByRole('input') include text inputs that already match the textbox role without changing existing role behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
accessibility, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.