Page MenuHomePhabricator

Add alt= parameter support for files in a <gallery>
Closed, ResolvedPublic

Description

Images have an alt= attribute, so one can describe the image and allow handicaped people to get audio information.

[[Image:Pic.jpg|alt=This is displayed if the image isn't shown! Furthermore, IE may show this as tooltip.]]

But it is impossibe with <gallery></gallery>.

I hope we could have somethig similar to the following:

<gallery caption="Sample gallery" widths="100px" heights="100px" perrow="6">
Image:Drenthe-Position.png|[[w:Drenthe|Drenthe]], the least crowded province.|alt=This is displayed if the image isn't shown! Furthermore, IE may show this as tooltip.
Image:Flevoland-Position.png|alt=This is displayed if the image isn't shown! Furthermore, IE may show this as tooltip.
</gallery>

I hope someone can fix this bug, I believe it is quite important for the accessibility.


Version: 1.18.x
Severity: enhancement

Details

Reference
bz18682

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 21 2014, 10:31 PM
bzimport set Reference to bz18682.

Given that there's a caption and a link to a detail page, can you provide an example of what might be used for alt text in a gallery?

Those seem like fairly decent alt texts, pretty rare! :D Not a bad use.

We should probably consider better ways to deal with alt text though -- perhaps these should be centralized to the image generally? If the file is used in multiple places, a description of its ''content'' will probably tend to be the same in most cases.

But being able to override it in a gallery as well as an indidivual usage makes sense. Parsing of additional parameters would need to be added; currently I believe gallery just splits the lines into name and caption pieces.

That's a great idea Brion, one that I actually just proposed at https://bugzilla.wikimedia.org/show_bug.cgi?id=19906

Please reconsider, Brion. Alt text depends heavily on context, as explained in our guidelines for alt text. http://en.wikipedia.org/wiki/Wikipedia:Alternative_text_for_images#Context

A centralized description could be stored nonetheless and used as default alt text. The override feature would guarantee that the alt text can be modified to better fit with the context in each case.

(In reply to comment #3)

We should probably consider better ways to deal with alt text though -- perhaps
these should be centralized to the image generally? If the file is used in
multiple places, a description of its ''content'' will probably tend to be the
same in most cases.

Note that this was requested as bug 19906.

Re-waking this bug as there's been some interest lately.

Here's a shorter example usage, using the same style as the page linked above:

<gallery>
File:Wiki.png|Wikipedia's logo|alt=A gray globe made of puzzle pieces, labeled with letters from many different writing systems.
</gallery>

The usage of the |s pretty much matches existing [[File]] tags; should be pretty easy to adapt, perhaps using the same functions as used there if it's not too deep in the parser.

info wrote:

Hello. Sorry for my bad English. Other examples of articles in which I took around the "bug" in describing the images into notes: http://fr.wikipedia.org/wiki/Boite_de_conserve#Notes_et_r.C3.A9f.C3.A9rences, http://fr.wikipedia.org/wiki/Cuisine_de_la_pomme_de_terre, http://fr.wikipedia.org/wiki/Conservation_de_la_viande
These descriptions have encountered criticism from French users when I submit the articles to the quality label because they add to the page and are unpleasant to people without disabilities. Technically, I cannot help, but as a writer, I very much hope that you can find a solution. Sincerely, Égoïté

maria.schiewe wrote:

I know that moaning won’t get this bug fixed, but I am desperate. I was quite happy when galleries were finally free of layout tables (#3276). However, gallery is as useless as before without the possibility to add alternative text to the images. The more images you have in an article, the more missing alt texts are annoying. And usually articles containing a lot of images (e.g. about paintings) are using galleries.

Is this bug too hard to fix? As an outsider it seems fairly easy to me adding the |alt=. Are there other reasons preventing this bug to get fixed? Or is it just not important enough? It do is for all the screen reader users!

jp.posma wrote:

Fix

This fixes the problem while not breaking existing captions with |s in it. Passes existing parser tests, and adds a new line to a parser test for checking this behaviour.

Apply patch to trunk/phase3.

attachment 18682 ignored as obsolete

(In reply to comment #11)

Created attachment 8444 [details]
Fix

This fixes the problem while not breaking existing captions with |s in it.
Passes existing parser tests, and adds a new line to a parser test for checking
this behaviour.

Apply patch to trunk/phase3.

Cool. I'll have a look at it tonight & will commit it if don't see any problems.

attachment 18682 ignored as obsolete

As an aside, it'd be cool if we could support all the normal thumbnail params (or the one's that make sense anyways). As it stands, you can't do thinks like specify show page 5 of a pdf in a gallery, or use lossless/lossy (whichever is not the default) thumbnail for a tiff file

(In reply to comment #13)

As an aside, it'd be cool if we could support all the normal thumbnail params
(or the one's that make sense anyways). As it stands, you can't do thinks like
specify show page 5 of a pdf in a gallery, or use lossless/lossy (whichever is
not the default) thumbnail for a tiff file

The only sane way imo, would be to split the param parsing stuff from makeImage() into a separate function & use it for the gallery stuff as well. Afterwords just ignore those params that don't apply.

Patched in r86749, Bawolff do want to open a new bug or edit this ones summary?

jp.posma wrote:

Second attempt

This patch again only adds the alt= tag, no other tags that normal images do have, as I'm not yet familiar enough with the parser to confidently do that. ;)

Also includes suggestions by diebuche (some cleanup) and Duplicatebug (correct magic word, wikitext inside caption, extra parser tests), and fixes a notice in MagicWord.php.

Patch to trunk/phase3.

Attached:

Patched in r86749, Bawolff do want to open a new bug or edit this ones summary?

It really should be a separate bug I suppose. In any case worrying about that shouldn't stop you from fixing this, just if there was an easy way to do all of them, that'd be really awesome. There's also bug 8480.

jp.posma wrote:

Committed by DieBuche in r86859.

*Bulk BZ change: -bugsmash from closed bugs. (7 Bugs)*