Page MenuHomePhabricator

Use commons image caption as alt text for article images
Open, Needs TriagePublic

Description

Currently in the homepage we render article images in the impact module (as thumbs in the articles list) and in the suggested edits module (as cards). The image for the cards has no accessible text and the article thumbs use the article title. It would be nice to retrieve the image captions if available and use them for the image alt texts.

Event Timeline

Tgr subscribed.

The caption is not suitable for alt text. Alt text is supposed to describe what information you can obtain by looking at the image. The caption provides supplementary information that a person looking at the image doesn't already have. Also the caption is probably going to be used as caption, which is also read by screen readers, so duplicating it is unhelpful. See the enwiki manual of style for more details.

There's T166094: Allow editors to provide default alt text on Wikimedia Commons file description pages but it isn't really making progress.

kostajh added subscribers: KStoller-WMF, kostajh.

That has since been resolved, so it's possible we could try to use that. @KStoller-WMF what do you think?

Seems like a good best practice to work on this, but do we have data on how many Commons images actually have alt text? If that percentage is low, then I imagine this change wouldn't have much impact.

Probably zero at this point, given that alt text storage on Commons is brand new and not integrated with any tooling yet.

Hi @Tgr ,

We are running a spike on Android, to make sure that there is no overlap between captions and alt text. Through our Suggested edits feature, we add captions to images on commons, that don't yet have a caption, using api parameter action=wbsetlabel. After reading through some of the alt text related tickets I see that the two fields will not collide in any way. i.e., our updating the labels will not affect alt text field and vice versa. Just wanted to confirm it here in case I have missed something. Thank you.

Hi @Tgr ,

We are running a spike on Android, to make sure that there is no overlap between captions and alt text. Through our Suggested edits feature, we add captions to images on commons, that don't yet have a caption, using api parameter action=wbsetlabel. After reading through some of the alt text related tickets I see that the two fields will not collide in any way. i.e., our updating the labels will not affect alt text field and vice versa. Just wanted to confirm it here in case I have missed something. Thank you.

@Sharvaniharan can you provide an example request of values that you use with action=wbsetlabel?

AFAICT the newly added P11265 property from T166094 is independent of whatever property is used for captions.

It's independent in the sense that changing one programmatically will not change the other. It's somewhat dependent from a user point of view in that they are supposed to be "deduplicated": you don't want the alt text to repeat the caption (as then a user with a screen reader would have to listen to it twice). So in theory if you add something to the caption that's present in the alt text, you should remove it from the alt text. Also, the enwiki style guide recommends using "refer to caption" as alt text when the caption already describes what's visible on the image; in that case if the caption is changed and it doesn't describe the image anymore, the alt text should be fixed.

I think in practice these are very niche situations and fine to ignore in a tool, though.