Open CWSites opened 1 year ago
I might be mistaken here, but if I understand correctly, the problem here is not the fieldset
. You have a div with an aria-label
of Access Type
and a label
pointing to the select
element with the text Access Type
. Therefor, we find two elements with that label (the div
and all it's descendants and the select
). Have you tried removing the aria-label
from the div
?
Changing the aria-label
removed one of them (thanks for that). However the fieldset
is definitely an issue as it was complaining that the label in question was returned three times.
<fieldset aria-hidden="true">
<legend>
<span>
Access type
</span>
</legend>
</fieldset>
From the error you've showed above, it looks like the fieldset
was inside the div
, that's why I thought it will be removed also.
Can you please gather a minimal reproduction for us to investigate this?
Sure, I will see about getting something put together. I'm using standard MUI v5 with react and this is how they render a select field.
@testing-library/dom
version: 8.10.1Relevant code or config:
What you did:
Testing to make sure a label is visible in the UI
What happened:
Multiple results were returned, including
fieldset
Problem description:
fieldset
is not part of the inputlabel
and shouldn't be included withgetByLabelText
Suggested solution:
Do not return
fieldset
when using a query*ByLabelText