LaTeXML
LaTeXML copied to clipboard
improve accessibility of SVG images
SVG images can be embedded via the <img> tag or via the <object> tag. LaTeXML uses the latter, and it causes issues with accessibility technologies [1].
A good starting point to frame the discussion is that W3C allows <object> to have roles application, document and img [2], while <img> can only have image-related roles [3]. As far as I understand, one should embed SVG images in the following way.
- With
<img>:- if the content is a static image or a non-interactive animation (SVG+SMIL), and with little or no textual content (roughly, any time the alternative description is sufficient).
- With
<object>:- for interactive SVGs and SVGs animated via Javascript, such as the ones generated by the
animatepackage (ARIA roleapplication); - if compatibility with outdated browsers is a concern (absolutely marginal [4]);
- for images containing an important textual component that should be part of the page, and e.g. be navigable with the keyboard (ARIA role
document).
- for interactive SVGs and SVGs animated via Javascript, such as the ones generated by the
It would be very helpful to let the users decide which container to use in an easy way; better yet if they have the option on a per-image basis. #1444 is a crude attempt at a global flag to switch between the two and to allow easy customisation via XSLT. An option could be to let users assign the appropriate ARIA role to each image, with reasonable defaults, and let LaTeXML pick the correct output.
I'll update the above lists if we find other relevant considerations.
[1] https://www.powermapper.com/tests/screen-readers/elements/#object [2] https://www.w3.org/TR/html-aria/#el-img [3] https://www.w3.org/TR/html-aria/#el-object [4] https://caniuse.com/svg-img, https://caniuse.com/svg