Improve Graphviz output accessibility for screen readers.
Continuing from discussion on https://forum.graphviz.org/t/adding-metadata-to-the-output/1074/1.
First priority: Allow adding alt
text for an entire Graph, when the Graph is output to SVG format. I think this will give us the most value, by allowing people to summarise entire graphs for visually impaired readers.
Second priority: Allow adding alt
text for image nodes like you can on the web.
For example, we could add a Graphviz attribute like alt
or desc
that outputs a <description>
tag for SVG output.
Graphviz's attribute would probably want to abstract over various output formats. SVG is probably most important, followed by PDF, then (probably far down the list) HTML image maps (we have an old bug filed about image map alt text: #265).
Prior art:
HTML:
- https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt
- https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/longDesc (deprecated)
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption
SVG:
- https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title (accessible, short-text description)
- https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc (accessible, long-text description)
We may want to, like SVG, allow specifying a long and short variant. Although it's not clear how other formats would support that.
Let’s start with letting the end user specify the alt text. I think auto-generating alt text will be too hard and end up being too verbose for screen readers, but we could explore that later.
The alt
, desc
, longdesc
, and title
attributes all seem as-yet unused in Graphviz: https://graphviz.org/doc/info/attrs.html.
I'd be interested in feedback on this plan. Maybe I'm being too ambitious trying to have this abstract across formats, for example.