Skip to content

ByRole: Constrain API further #1202

Closed
Closed
@eps1lon

Description

@eps1lon

Describe the feature you'd like:

As part of https://gist.github.com/bvaughn/d3c8b8842faf2ac2439bb11773a19cec I'm revisiting a lot of selector APIs from different libraries.

The API of ByRole stood out with regard to role selection and its options.

Suggested implementation:

  1. Constraint role to string
  2. match fallback roles (e.g. byRole('none') === byRole('presentation') in <div role="none presentation" /> Leaving for now. Not so clear what's the best default here
  3. Remove exact option
  4. Remove normalizer option

Describe alternatives you've considered:

Document concrete use cases (motivated by real-world tests). If you have some, please let me know.

Teachability, Documentation, Adoption, Migration Strategy:

We can document fallback role matching in a footnote. I expect that most queries will not be concerned with fallback roles.

Constraining the API makes teaching this query easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BREAKING CHANGEThis change will require a major version bump

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions