-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Allow specifying alt text for IPython.display.Image. #12864
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
Conversation
For accessibility reasons users should be encouraged to add useful alt text to images. Currently there is no recommended way to do this using the standard Image object. Adding this field is a step towards getting a common way for notebook renderers to support alt text and towards encouraging libraries creating images to add meaningful alt text.
This is brilliant, and we should do it at the syntax level so that people can adopt it easily. However, Ideally, we'd encourage consistency at the metadata level by adding "blessed" terms to the nbformat JSON schema so that clients aren't playing guessing games. The best of worlds would be to identify an existing standard, whether in JSON schema or whatever: my pick for this would be the web annotation data model which has mappings to w3c annotation-aria which can be accessibly embedded in html. Practically, this would mean replacing: "metadata": {"image/png": {"alt": "a picture of an elephant"}} to... "metadata": {"image/png": {
"annotations": [
# some more verbose JSON that other tools can read and reason about
]
}
} For some related things around making complex things describable, the p5 folk have done and written about some sterling work. |
I honestly do not have much experience in this area and am happy to defer to others for a more formal specification if there is interest in that direction. I think this is particularly important because while many people have been doing great work to make the tools accessible for the authors of these notebooks this seems like an obvious gap for the readers of these notebooks, especially given the plethora of publishing avenues. |
@blois really, thanks for starting this: I don't think anybody is experienced at this point, as we're trying to do something relatively difficult across a large number of pieces.
This is definitely the motivation for getting the metadata right. With the right metadata, we can enrich:
Starting where you have is a really great place! |
@bollwyvl If the desire is more than a plain string then it probably makes sense for this to be specified in nbformat first. I had started here since it appears to be the de facto specification for output metadata fields. |
I'd prefer to avoid broadening the scope of this change to to encompass more accessibility features across more types of outputs as I feel that work is much larger, more speculative and lacks a clear owner. Adding an If there can be a more generalized set of accessibility metadata added to nbformat and outputs then it should be entirely reasonable for those to supersede simpler Please let me know if there are further changes I should make here, otherwise feel free to close this PR if an nbformat specification approach is preferred. |
I personally prefer keeping it as:
The closer we can keep it to what that coding languages already exists (HTML, JQuery, etc) the better. Users shouldn't have to learn a new language or way of doing things just to support persons with disabilities/handicaps. |
Sorry for the delay in reviewing / merging. I have no opposition to this, it's just unclear to me if you want to get that in as is, or build consensus first. Let me know and I'm happy to merge. |
If someone is interested in picking up the work to formally spec accessibility for outputs then I think this PR should be dropped. I opened jupyter/accessibility#37 and attended the regular meeting to discuss, I do not believe anyone currently has the time to pick up the larger work. I don't think there's any immediate urgency for this issue and am fine waiting to see if we can build traction elsewhere. The one thing is that once some variant of this lands is that it may be good to try to get matplotlib images to automatically fill in the alt text. I believe the primary work would be somewhere in ipython/IPython/core/pylabtools.py Line 209 in d737c32
|
At this point I believe that the approach proposed here is the best path forward. I'd like to see this merged so we can move on to encouraging users and libraries to include accessible alt text on images. |
I agree that landing this as-is is the best start. It doesn't preclude more detailed abstract approaches, and we shouldn't have to wait for those. This is simple, straightforward, and solves a real issue without introducing any conflict with other ideas. |
I'm not speaking from a technical background here, but I would love to see this happen. I've had people in multiple communities now ask me for best practices on how to describe images like this, so I think it this would be a great step in getting a standard and supported method for alt text. Since this has an approval, what are the next steps to getting this merged? |
I believe that the next step is that someone with write access to the repo needs to merge it. Please let me know if there is any action required on my part. |
THanks, let's get that in an iterate if necessary. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove If these instruction are inaccurate, feel free to suggest an improvement. |
For accessibility reasons users should be encouraged to add meaningful alt text to images. Currently there is no recommended way to do this using the standard Image object. Adding this field is a step towards having a common way for notebook renderers to support alt text and towards encouraging libraries creating images to add meaningful alt text.
See https://www.w3.org/standards/webdesign/accessibility#examples
Currently JLab just does https://github.com/jupyterlab/jupyterlab/blob/master/packages/rendermime/src/renderers.ts#L674.
I'd like to see the ecosystem get to the point where titles on graphs displayed as images automatically become alt text for those images.