Closed JuhG closed 5 months ago
This is a really strange bug and plagued me as well, I solved it by using aria-labelledby
and switching to getByLabelText
. The other solutions—remove :disabled
styles or nest <input />
inside <label>
—didn't apply well to our particular use case
Potential duplicate / related to https://github.com/testing-library/dom-testing-library/issues/1101?
Closing in favor of https://github.com/testing-library/dom-testing-library/issues/1101
@testing-library/dom
version: 8.5.0@testing-library/react
version: 13.4.0Relevant code or config:
What you did:
I was testing a checkbox component and sometimes I got this error. Tried to narrow the issue down, this is how far I got.
What happened:
I get this error:
Reproduction:
https://codesandbox.io/s/vibrant-tess-9mvjex?file=/src/App.test.tsx
Problem description:
Not sure what exactly causing this, but all these things are needed for me to reproduce:
name
disabled
If you move the label inside or remove the disabled style, the error goes away. If I should open an issue in another repo, please let me know. Thanks!