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

[Accessibility] some accessibility improvements #2021

Merged
merged 8 commits into from
Jul 15, 2023

Conversation

brichet
Copy link
Contributor

@brichet brichet commented Jul 10, 2023

This PR improves the accessibility of the produced HTML file, using the HTMLExporter:

  • adds a main landmark for the Notebook content
  • adds a lang attribute to the html tag, configurable with a trait
  • adds missing alternative text on images produced by matplotlib
  • adds tabindex="0" to the inputs and outputs, in order to be able to navigate through the Notebook using the tab key

@mgeier
Copy link
Contributor

mgeier commented Jul 10, 2023

I'm not a user of a screenreader, so I might be missing something, but how is alt="Image" helping anyone? Doesn't a screenreader already tell you it's an image? Wouldn't it say "image" twice? Assuming the screenreader is even used by an english-speaking user ...

I don't know a solution here, but I would like to point out previous discussions: #1993, matplotlib/matplotlib#21328

@brichet
Copy link
Contributor Author

brichet commented Jul 11, 2023

I'm not a user of a screenreader, so I might be missing something, but how is alt="Image" helping anyone?

Thanks for pointing out some discussions.

I agree that it's not really useful as such.
Nevertheless, it seems that the screenreader needs it, at least the Deque University Axe Devtools complains about it. But for informative image, the alternative text should be informative: https://dequeuniversity.com/rules/axe/4.4/image-alt, which is not the case here.

I don't think we can even tell that it's an image from matplotlib when building HTML, so I don't know neither how we can have any information about the content.
The best solution is to have if fixed from matplotlib.

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@blink1073 blink1073 merged commit ef007a8 into jupyter:main Jul 15, 2023
@krassowski
Copy link
Member

I agree that it's not really useful as such.
Nevertheless, it seems that the screenreader needs it, at least the Deque University Axe Devtools complains about it.

I don't think that blindly satisfying the automated checks here is the right approach. This will provide a false sense of satisfying the requirements. If a notebook contains images without alt the check should error out.

@brichet brichet deleted the accessibility branch July 17, 2023 08:26
@brichet
Copy link
Contributor Author

brichet commented Jul 17, 2023

If a notebook contains images without alt the check should error out.

The problem comes from images generated by Matplotlib (at least), and I don't know if it can be fixed by a user currently.
Maybe we could at least have a more consistent text, something like "No description is provided for this image", and print a warning when the HTML is generated.

@blink1073
Copy link
Contributor

I'm cutting the release, we can follow up with further improvements in a bug fix release.

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

Successfully merging this pull request may close these issues.

4 participants