Open sebinsua opened 2 years ago
This had occurred to me when I was implementing the find*
queries, but I guess I kind of assumed that since hidden
in Testing Library terms is more directly related to the accessibility tree, these concepts were sufficiently separated. However, as you pointed out, there is definitely an overlap between them.
I'll add some test cases for this soon to help get a feel for how big that overlap is and how confusing these things are when used together. Hopefully, that will give us a more clear path forward including the implications of this potential breaking change:
I don't know a fix for this unless we automatically force
options.hidden === true
in these cases and haven't thought through the consequences of doing this.
I was thinking that because of things like aria-hidden
that the best we may be able to do is print an explicit warning when these options are combined in certain ways or when queries fail because of said combination. Bleh, idk, this is a tricky one. Thanks for raising this!
One thing that I've noticed is the possibility of disagreement between the visibility checking of Playwright and Testing Library.
For example, what if internally we are executing
locator.waitFor({ state: 'attached' })
but are also querying usingoptions.hidden === false
with Testing Library. The latter programmatically ensures that elements are not picked up due to "host language semantics specifying that the element is not displayed, such as CSSdisplay: none
,visibility: hidden
, or the HTMLhidden
attribute".I don't know a fix for this unless we automatically force
options.hidden === true
in these cases and haven't thought through the consequences of doing this.