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
it("includes svg aria-label in description text",()=>{render(<><labelhtmlFor="input-id">input</label><inputid="input-id"aria-describedby="description-id"/><divid="description-id"><svgrole="img"aria-label="error"/> message
</div></>);expect(screen.getByLabelText("input")).toHaveAccessibleDescription("error message");});
What you did:
Screen readers include the svg aria-label in the accessible description, but computeAccessibleDescription (via toHaveAccessibleDescription in jest-dom) does not.
What happened:
Expected element to have accessible description:
error message
Received:
message
If an SVG (or a number of other elements) element has an aria-label, that should probably trump all the other checks and the value of the aria-label attribute should be returned, right?
This issue was originally reported here testing-library/jest-dom#500, but it was noted that the underlying issue is here in the computeAccessibleDescription method.
@testing-library/jest-dom
: "5.16.5"@testing-library/react
: "13.4.0"node
version: 18Relevant code or config:
What you did:
Screen readers include the svg aria-label in the accessible description, but
computeAccessibleDescription
(viatoHaveAccessibleDescription
in jest-dom) does not.What happened:
Reproduction:
https://codesandbox.io/s/react-testing-library-demo-forked-45xzdn?file=/src/__tests__/toHaveAccessibleDescription.js
Problem description:
aria-label contents are not included in the accessible description.
Suggested solution:
aria-label contents should be included in accessible descriptions.
The text was updated successfully, but these errors were encountered: