question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Properly-structured SVG incorrectly fails svg-img-alt

See original GitHub issue

Expectation: SVG with a <title/> child element should pass test.

Actual: Failure cites lack of a <title/> child element when one exists.


axe-core version: 4.0.2
jest-axe: 4.0.0

- Node version: v12.16.1
- Platform:  Mac

SVG element markup:

<svg role="img">
    <title>Accessible title</title>
    <path d="M4,2 C4,3.104 3.104,4 2,4 C0.896,4 0,3.104 0,2 C0,0.896 0.896,0 2,0 C3.104,0 4,0.896 4,2" />
</svg>

axe-svg-img-alt-bug

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
strakercommented, Oct 23, 2020

It seems the issue is with jsdom and setting the svg title node to always be display: none. I have filed an issue with jsdom.

0reactions
sevenfourcommented, Jun 7, 2022

In case this is still relevant and could be useful (since the jsdom issue #3064 seems to be still opened), the temporary workaround by following @straker’s PR might be adding the following to the global Jest config:

window.document.head.insertAdjacentHTML('beforeend', `<style>svg title { display: inline; }</style>`);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessible SVGs | CSS-Tricks
Scalable Vector Graphic (SVG) is emerging as the preferred graphic format to use on ... All <img> tags need the alt attribute to...
Read more >
Chrome not rendering SVG referenced via <img> element
This happens when refreshing the page and initial page load. I can get the image to show up by "Inspecting Element" then right...
Read more >
SVG images and graphics require accessible text | Axe Rules
SVG images and graphics require accessible text. Rule ID: svg-img-alt. Ruleset: axe-core 4.2 ... How to Fix the Problem. Ensure that all SVG...
Read more >
Accessibility Features of SVG - W3C
SVG's vector-graphics format stores structural information about graphical shapes as an integral part of the image. As we discuss below, this ...
Read more >
include svg images with the svg package - TeX
ERROR: LaTeX Error: Unknown graphics extension: .svg. How can I fix this problem? I'll prefer not having to convert all my svg files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found