Page MenuHomePhabricator

File caption in a gallery duplicated to alt= after being edited
Closed, ResolvedPublic

Description

An example is https://ca.wikipedia.org/w/index.php?title=Smith_%26_Wesson&curid=940802&diff=30407429&oldid=30407426

This was anticipated in https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/804404

VE will display the content in both the alt field and the caption, and
they'd need to be edited in sync to avoid being duplicated and diverge.
The editing experience when the caption isn't visible can stand to be
improved as it is though.

Opening this task to track how big of an issue it becomes ...

The UI in VE should probably have a checkbox that says "Use the caption as the alt" and have it checked by default. It'll be unchecked if the caption and alt differ in the source. And note that all this only applies if the media isn't a thumb/manualthumb/frame.

Event Timeline

Change 810980 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/extensions/VisualEditor@master] [WIP] Add a checkbox to use the caption as the alt text

https://gerrit.wikimedia.org/r/810980

Change 810980 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add a checkbox to use the image caption as the alt text for galleries

https://gerrit.wikimedia.org/r/810980

✅ The UI in VE has a checkbox that says "Use the caption as the alternative text" and has it checked by default.
{F35367098}
When the alt text is same as the caption, it looks like File:Screenshot 2022-01-28 at 03.01.40.png|Caption

Screenshot 2022-07-31 at 20.06.48.png (1×1 px, 126 KB)

When the alt text and caption differ, it looks like File:Screenshot 2022-01-28 at 02.58.35.png|alt=Alt text for blank image|All blank
Screenshot 2022-07-31 at 20.09.21.png (1×1 px, 127 KB)

Further observation:

  1. @matmarex In https://photos.app.goo.gl/Gf4pxyPgGesbHQc96,

The caption I put in 0:22 disappears when I try to update it in 0:28. Then the output looks like [[File:Darkscreen.png|alt=A topic|frameless]] in 0:53

  1. I somehow can't get the desired result I get when I am adding images to a gallery as detailed above. I tried a Fameless image type.

Further observation:

This was noted in the task description,

The editing experience when the caption isn't visible can stand to be
improved as it is though.

and existed prior to any changes in how the alt attribute is serialized.

So, I opened T314325 to deal with it separately.

The patch in T311677#8050077 resolves this task for galleries but the checkbox can also be added to inline and block media when the caption isn't visible (ie. not framed or thumb). But that is probably a lower priority task

matmarex renamed this task from File caption duplicated to alt= after being edited to File caption in a gallery duplicated to alt= after being edited.Aug 3 2022, 6:24 PM
matmarex removed a project: Editing QA.

Per Arlo. As far as I know this bug only affected galleries. The issue with inline images is separate (thanks for filing it).

As far as I know this bug only affected galleries.

It's relevant to any media instance that isn't a thumb, manualthumb, or frame, as well as galleries. However, in those instances, the caption isn't displayed so it's less likely to be edited. Galleries are the only place where the caption is both displayed and duplicated to the alt, so I felt it was a higher priority.

It's fine to make this task solely about galleries and we can open a new one if there's editor confusion in the other instances.