Tried to test rendering of an aria-hiddensvg by using getByRole with the options { hidden: true, name: accessible_name } where accessible_name is the text node inside the svg's title element.
What happened:
Found I could only make this work when the svg is not aria-hidden (and I don't need to add { hidden: true } to the getByRole options, although the test passes whether or not I remove that option).
@testing-library/dom
version: 7.31.2Relevant code or config:
In React, but using
dom-testing-library
under the hood:Note that this will still get the SVG, if it's the only element with
role="img"
SVG is not
aria-hidden
:What you did:
Tried to test rendering of an
aria-hidden
svg
by usinggetByRole
with the options{ hidden: true, name: accessible_name }
whereaccessible_name
is the text node inside thesvg
'stitle
element.What happened:
Found I could only make this work when the
svg
is notaria-hidden
(and I don't need to add{ hidden: true }
to thegetByRole
options, although the test passes whether or not I remove that option).Reproduction:
https://codesandbox.io/s/happy-darkness-zy83ig (run tests)
Problem description:
This PR evidently fixed using
title
as an accessible name forsvg
elements. But evidently this still doesn't work if thesvg
isaria-hidden
.Suggested solution: