You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<dl>
<dt>Firefox</dt>
<dd>
A free, open source, cross-platform,
graphical web browser developed by the
Mozilla Corporation and hundreds of
volunteers.
</dd>
</dl>
The query:
// Says "your element isn't named properly":screen.getByRole('definition')/*// Returns undefined:screen.getByRole('definition', { name: "open source"})*/
What you did:
Trying to select a <dd> with its accessible name.
What happened:
testing-library says the accessible name is an empty string, even though Firefox's accessibility inspector says the text content is the accessible name:
I saw one early mention of this, but that was just in a comment that wasn't turned into a full issue: #866 (comment)
Hi @Vinnl!
Thanks for taking the time to open this issue.
Unfortunately, every browser decides how to compute the accessible name.
In our library, we try to follow the standards and as far as I was able to find, role: definition doesn't support name from content, which means that the accessible name algorithm won't tag the content as the accessible name and therefor lead to you not finding it by the name.
In this case I'd probably suggest to query the item by it's text instead.
Hope this is helpful :)
Have a great year!
@testing-library/dom
version: See below.Relevant code or config:
On the playground: https://testing-playground.com/gist/f903fd3577b600fa971fa80f3580bad1/8def0ea97e0143cdfb7a57db33ee4bf3d43228a2
The DOM:
The query:
What you did:
Trying to select a
<dd>
with its accessible name.What happened:
testing-library says the accessible name is an empty string, even though Firefox's accessibility inspector says the text content is the accessible name:
I saw one early mention of this, but that was just in a comment that wasn't turned into a full issue: #866 (comment)
Reproduction:
https://testing-playground.com/gist/f903fd3577b600fa971fa80f3580bad1/8def0ea97e0143cdfb7a57db33ee4bf3d43228a2
Problem description:
I can't match on a definition list by its accessible name.
Suggested solution:
I think testing-library should recognise the text content as the accessible name? And probably the same holds true for
<dt>
.The text was updated successfully, but these errors were encountered: