I was running into some accessibility audit errors with Jupyter Book, and it made me realize that the _repr_html_ method of Figures doesn't output img elements that have alt tags (something that screen readers like).
It seems that the relevant code is here:
and then uses the template that's referenced here:
|
tpl = Path(core.FigureManagerWebAgg.get_static_file_path(), |
Maybe using this?
https://github.com/matplotlib/matplotlib/blob/be978a35932a9f303f3d60f14f52ed9df89334c5/lib/matplotlib/backends/web_backend/js/mpl.js
I wonder if this could be a relatively simple fix by making the figure title the alt tag by default, and if it doesn't exist, just making it something like Figure?
I was running into some accessibility audit errors with Jupyter Book, and it made me realize that the
_repr_html_method of Figures doesn't outputimgelements that havealttags (something that screen readers like).It seems that the relevant code is here:
matplotlib/lib/matplotlib/figure.py
Line 378 in 59acd5c
and then uses the template that's referenced here:
matplotlib/lib/matplotlib/backends/backend_webagg.py
Line 289 in 690fd71
Maybe using this?
https://github.com/matplotlib/matplotlib/blob/be978a35932a9f303f3d60f14f52ed9df89334c5/lib/matplotlib/backends/web_backend/js/mpl.js
I wonder if this could be a relatively simple fix by making the figure title the
alttag by default, and if it doesn't exist, just making it something likeFigure?