Skip to content
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

Provide default alt text for code generated images #1993

Open
rgaiacs opened this issue May 13, 2023 · 2 comments
Open

Provide default alt text for code generated images #1993

rgaiacs opened this issue May 13, 2023 · 2 comments

Comments

@rgaiacs
Copy link
Contributor

rgaiacs commented May 13, 2023

Consider a cell with

from matplotlib import pyplot as plt

plt.plot([1, 2, 3], [1, 2, 3]);

The default rendering of the output is

<div class="output_wrapper">
<div class="output">


<div class="output_area">

    <div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="data:image/png;base64," >
</div>

</div>

</div>
</div>

</div>

Should we have an default alt text?

<div class="output_wrapper">
<div class="output">


<div class="output_area">

    <div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="data:image/png;base64," alt="Image generated using the above code." >
</div>

</div>

</div>
</div>

</div>

Related issues and pull request: #1112

cc @Jenneh @isabela-pf

@mgeier
Copy link
Contributor

mgeier commented May 15, 2023

matplotlib/matplotlib#21328 might also be related, see also spatialaudio/nbsphinx#646.

@tonyfast
Copy link

I'll agree that adding alt text is meaningful. Not all images need alt, and the existence of alt text differentiates between decorative images and informative images. When images or figures are used in outputs we can assume they are informative and a lack of alt text is a impending violation.

With that said, coming up with a meaningful default message is completely ill defined. So yes we should have alt text, but what that should be is hard to imagine. alt should describe the image itself and we need to avoid misusing alt text. We can't make assumptions about the compute context or infer the meaning of the figure. The best we can say is "there is an informative image here, it is not decorative". Ultimately, we are delivering bad news to visually impaired users that they can't participate in all of the information, but at least the existence of the figure is announced because it is not decorative anymore.

another practical implementation would be some guard rails that produce errors (strict more) or warnings that they are producing inaccessible images or content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants