Page MenuHomePhabricator

When using media filename for alt text, do not include file extension
Closed, ResolvedPublicFeature

Description

There's a fallback in image gallery that the alt text for an image is set to the filename if no more specific text is available. This includes the filename extension which is not informative for someone reading the page. This change proposes to strip off any extension from the filename.

Before:

<img alt="Kogeloog ijskoffies.jpg" ...

after:

<img alt="Kogeloog ijskoffies" ...

Event Timeline

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

[mediawiki/core@master] [WIP] Do not use media filename as alt attribute

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

Change 887845 merged by jenkins-bot:

[mediawiki/core@master] Do not use media filename as alt attribute

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

Arlolra claimed this task.
Arlolra added subscribers: cscott, Arlolra.

In T326041#8599931, @cscott writes,

I think this option (removing the 'alt' attribute) is good and preferable to the alternative (removing just the file extension), as my understanding is that modern screen readers can actually do a limited form of machine vision processing on images without alt tags. It's not as good as human-generated alt info, of course, but they can describe the general image ("yellow rectangle on green background") and even do text-to-speech on any embedded text. I assume (feedback welcome!) that is more helpful than just repeating the filename, and that the screen reader isn't going to do any of that magic if it "thinks" there's a valid alt attribute already present. So in the interest of "honest output" I think suppressing the alt attribute when we don't actually have any human-generated content to put there is the right thing to do.

@Tkinkhorst Thanks for the patch, and sorry for the slow review, but we've gone the route of no longer falling back to the filename for the alt attribute.

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

[mediawiki/core@master] Strip off extension when using filename for alt text

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

Change 866483 abandoned by Thijs:

[mediawiki/core@master] Strip off extension when using filename for alt text

Reason:

superseeded by other change

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