Page MenuHomePhabricator

Image alt text should be compulsory
Closed, DeclinedPublic


Author: wikimedia-bugzilla

Despite what some people think, *every* image should have an alt text. These are
the W3C specs (, aimed at making the web
more accessible for people using non-visual browsers, text-based browsers, or
browsing with images disabled. Wikipedia is supposed to be an encyclopedia for
everyone - including the blind, the colour-blind, and people with limited
connections and devices.

Either the markup for including an image in a page should require alt-text, or
alt text could be made compulsary on the image page, and automatically included
in all pages using the image.

This is a MediaWiki issue, because making alt text compulsary is the only way to
make MediaWiki pages validate for basic accessibility.

For a fuller explanation, see
images should have alt text . Please keep comments here technical rather than
idealogical; otherwise comment at Wikipedia.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 8:31 PM
bzimport set Reference to bz2443.
bzimport added a subscriber: Unknown Object (MLST).

And, indeed, all images get alt text. The default is the filename (remember,
uploaded filenames are supposed to be descriptive).

wikimedia-bugzilla wrote:

Post 1.4.5? (it isn't working at Wikipedia now, eg.

wikimedia-bugzilla wrote:

The change, whenever it was made, wasn't retroactive, because there are many
images without alt text (eg. the above link). Missing alt text (or alt="alt
text") should not be possible ever.

There was no "change". Images have always had an alt attribute stuck
on them ever since they were supported.

wikimedia-bugzilla wrote:

Then why do some of the images on that page have no alt text?

Provide specific examples, please.

(Note that an *empty* alt text may be perfectly legitimate for non-functional
content, and is in fact recommended by the document you gave above, so that
should be possible when needed.)

wikimedia-bugzilla wrote:
The second image on the page has the alt text "alt text". Every image on the
page without a caption, except the two after "text text text text text text",
have no alt text.

In other words, every image without a caption specified in the wikisyntax (eg.
[[Image:Westminstpalace.jpg|right|50px|]]) and also some with a hidden caption
(eg. [[Image:Westminstpalace.jpg|thumb|This text is not
displayed.|70px|left|]]), have no alt text.

If the user explicitly ants to remove the alt text of an image, inserting an empty caption, then no alt text should be rendered.

I'll show you the problem:

On, the first image of each cell has the description, with a x1, x2 or x3 depending on how many images are there. I don't want alt text for the rest of the images because the first of all does what I want.

The list was showing perfectly in text-browsers, copying and pasting the table in a text program or disabling images. Now the name of the image is shown in all of the images, so there's no sense to the list when the images are not shown. The names of the image are descriptive, but the same title of the image repeated two or more times makes no sense and puts too many text inside a cell.

The possible solution:

[[Image:Blah.png]] must show the name of the image as alt text.

[[Image:Blah.png|]] or [[Image:Blah.png| ]] must NOT show any alt text because the user EXPLICITLY doesn't want an alt text to be put there. Put a empty alt, or no alt at all.

Yeah, I know that I could use a composed image so instead of two same images I would use one, but i don't want to upload a bunch of repeated images on the wiki.

Also, split the alt text between the images is really stupid.

The actual behavior (in my example) is against #367. This is the reason for opening the bug.

(In reply to comment #9)

Note that the problem is not the alt attribute of <img>, but the title attribute of the wrapping <a> (linking to the image description page), which is automatically set to the file title in case the alt attribute is empty (see function getDescLinkAttribs in includes/MediaTransformOutput.php).

robert wrote:

I can confirm this bug, images without captions have alt="" -- the actual hover text is coming from the title attribute of the link to the image description page. Alt text is desired in all default circumstances so I presume that a patch for this would get accepted into the code, however I don't see that a method for not having alt text needs to be created. [[Image:Example.png| ]] would do this AFAIK (providing a work around), and it is required that at least some text be in the alt tag on images. Since this is not to big of a change I will work on a patch if one is not made before I get round to it.

Reverted in r33956. This broke four test cases:

4 previously failing test(s) now PASSING! :)
   * Right-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
   * Centre-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
   * None-aligned image  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]
   * Width + Height sized image (using px) (height is ignored)  [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now]

Please recommit with fixes to the existing test cases and some new test cases to cover cases where an empty caption is explicitly requested, as in comment #11.

The first line of comment 13 is incorrect; this was reverted in r38956.

Have been discussing this off-and-on with some of the other developers, and I don't see a huge reason to do this.

  1. There are legitimate times to not use alt text for images, regardless of what the W3C says on the issue.
  1. Forcing people to specify and alt text will just end up with people writing useless alt texts in order to meet the requirement enforced by the software.

While specifying a default alt text is useful, it's already covered by bug 19906. Closing this one WONTFIX.