Skip to content

Hidden elements should not be queriable #497

@matheus1lva

Description

@matheus1lva
  • DOM Testing Library version: 7.1.1
  • node version: 12

Relevant code or config:

All the code and test can be found here:
https://codesandbox.io/s/sad-dijkstra-fx8i8

What you did:

I have a hidden element on my screen (either via visibility: hidden or display: none), when trying to query for something that is inside this element, it is being found! Which is technically "wrong" because the user is not seeing it!

Suggested solution:

Ideally (in the most ideal scenario) would be to now show this. I saw that are few implementations of this on cypress and other E2E libs, but not specifically here! This would be great, because we are testing what the user is seeing, not how the dom is being written!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions