Skip to content

*byRole("listbox") does not properly query <select /> elements #1082

@nicklemmon

Description

@nicklemmon
  • @testing-library/dom version: @testing-library/dom@8.11.0
  • Testing Framework and version: @testing-library/cypress@8.0.2
  • DOM Environment: Cypress/browser (though the issue is reproduced in the Codesandbox that follows via Jest/JSDom)

Relevant code or config:

<label for="my-select">My Select</label>

<select id="my-select"></select>
// Using `dom-testing-library` via `cypress-testing-library`
cy.findByRole("listbox", { name: "My Select" }); // Doesn't work, element not found
cy.findByRole("combobox", { name: "My Select" }); // Does work! But this isn't the right ARIA role

What you did:

What happened:

Reproduction:

Codesandbox reproduction

Problem description:

  • A <select /> should be query-able via *byRole("listbox")

Suggested solution:

Thanks for all of your great work on this library - it's truly a game changer in the space 🎉

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions