Skip to content

getByRole(role, { current: true }) #864

Closed
@josephrexme

Description

@josephrexme

Describe the feature you'd like:

The getByRole query is very versatile and helpful in helping us put accessibility at the forefront of our testing. It currently includes options like selected, checked to select based on state. This is great but it seem to be missing out on one of such states that is usually defined by users to determine active/current section: aria-current. It will be great if we can pass that option that checks for this aria attribute

Suggested implementation:

Since aria-current may be used in different ways e.g aria-current="page", aria-current="location", aria-current="step" we may consider making the option take a string like:

getByRole("button", { current: "page" })

but so far in my presumed usage it seem like this can be sufficient as:

getByRole("button", { current: true })

checking only the existence of the aria-current attribute as it's unlikely more than one type is being tested at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions