-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📖 Improve accessible figures with Jupyter docs #1077
Conversation
We haven't considered alt-text for Jupyter outputs, as many of these can be interactive, tables, text, or other elements. I think that we could and should special case images and override the alt text in the case of a single image in an output. I don't know what we would do for other cases though? For figures, we are adding semantics of a |
I am curious if this is related to this @choldgraf or the timing is just a coincidence?! |
Ah yeah that makes sense - so for now we should just recommend wrapping visual outputs in a figure in order to set alt text with the caption. Does that sound right? IMO that is a reasonable first step that gets us most of the way there without adding more complexity. Your multiple images point is a good one - is that generally not a recommended practice? And if so not then perhaps we should warn against it in the docs as well. I can see how things could be confused if we did stuff like attach a label to a cell with multiple outputs. For timing, I was partially inspired by a post I saw @willingc make online yesterday, and I wonder if this is the same thing that inspired @minrk - it certainly made accessibility top of kind and caused me to realize that you can already get close to this with MyST, so I wanted to document it! |
@rowanc1 I've updated the PR to:
LMK if this looks OK or merge if you like! |
the
the assistive solution for multiple images or subplots would start with the |
This adds some more information on how you can make Jupyter image outputs more accessible with alternative text by embedding them with image and figure directives. It also updates some of the labeling for the jupyter outputs to follow a
type:label
structure (likeimg:altair-horsepower
instead of justaltair-horsepower
).But does alt-text for images work for Jupyter outputs?
However I noticed that alt-text with a notebook image output doesn't seem to work properly. For example, if I do this to embed a matplotlib output:
Then the resulting
alt text
for the image is:<Figure size 640x480 with 1 Axes>
. I suspect this is the default alt-text that you get from the notebook output. I would have expected the embed code to over-ride this.Is this a bug? Or is it expected behavior, and we should recommend that people use
{figure}
instead of{image}
to make notebook outputs accessible for screen readers?