Last modified: 2014-06-01 12:43:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 12456 - Links surrounding images always have a title, even if alt text is empty
Links surrounding images always have a title, even if alt text is empty
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.12.x
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
http://spiele.j-crew.de/wiki/SpieleWi...
: need-parsertest, patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-30 16:14 UTC by Thomas Bleher
Modified: 2014-06-01 12:43 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Thomas Bleher 2007-12-30 16:14:42 UTC
Using the new parser, using [[Image:some.png|<nowiki/>]] does not work anymore, i.e. it produces an alt text of "some.png", when it should be empty.

http://spiele.j-crew.de/wiki/SpieleWiki:Test demonstrates the problem (the site was updated from SVN a few days ago).

I cannot reproduce this on Wikipedia sites; I think it works there because Wikipedia is still using the old parser.
Comment 1 Thomas Bleher 2008-01-03 19:11:20 UTC
I have to correct myself: It doesn't seem to be a bug of the new parser (at least I can now reproduce it using the old parser) and the alt text is in fact correct. The problem is that the surrounding link has a 'title' attribute, so the HTML produced for [[Image:some.png|<nowiki/>]] is

  <a href="/wiki/Image:Some.png" class="image" title="Some.png"><img alt="" src="some path" width="474" height="466" border="0" /></a>

when it should be

  <a href="/wiki/Image:Some.png" class="image" title=""><img alt="" src="some path" width="474" height="466" border="0" /></a>

leading to a tooltip with "Some.png" in it when hovering over the image (at least in Firefox and Konqueror).

I still think this is a bug, but at least it should not affect screen readers and the like, so I'm reducing the severity.
Comment 2 Thomas Bleher 2008-01-03 19:50:02 UTC
Proposed patch:

--- includes/MediaTransformOutput.php   (Revision 29164)
+++ includes/MediaTransformOutput.php   (Arbeitskopie)
@@ -76,10 +76,6 @@

        function getDescLinkAttribs( $alt = false ) {
                $query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : '';
-               $title = $this->file->getTitle();
-               if ( strval( $alt ) === '' ) {
-                       $alt = $title->getText();
-               }
                return array(
                        'href' => $this->file->getTitle()->getLocalURL( $query ),
                        'class' => 'image',


Sidenote: Looking through the parser tests, I saw that [[Image:Some.png]] has an alt-text, while [[Image:Some.png|right]] doesn't have one. I think that's a bug, too, but a very low priority one.
Comment 3 Sumana Harihareswara 2011-09-26 15:49:06 UTC
Thomas, can you check whether your proposed patch works against current trunk, and attach it to this bug as a diff?  Thanks!
Comment 4 Thomas Bleher 2011-09-28 21:53:27 UTC
I'm sorry, but I don't currently have any time for MediaWiki development. So if someone else could check this, it would be great :)
Comment 5 John Du Hart 2011-09-29 20:09:43 UTC
Patch no longer works against trunk, however I'll take a look at fixing the bug.
Comment 6 John Du Hart 2011-09-29 20:14:28 UTC
But isn't a file name better than an empty alt="" tag? I think that the current behavior is more desirable. Is there a case where you feel it isn't?
Comment 7 Thomas Bleher 2011-09-29 20:25:50 UTC
Some images are purely for decoration, they should not produce any text in a screenreader or text-only browser. As a random example, look at the headings in http://spiele.j-crew.de/wiki/Die_Wasserzwerge . On that wiki, there are standardized headings, each containing an image on the left, to make the sections stand out. But a screenreader should completely ignore these images.

I think MediaWiki should provide a syntax to achieve this. It used to work by adding <nowiki/> as the title, like this: [[Image:some.png|<nowiki/>]]
Comment 8 C. Scott Ananian 2014-05-29 20:13:01 UTC
Doesn't [[Image:some.png|alt=]] do what you want?
Comment 9 Thomas Bleher 2014-06-01 12:43:30 UTC
I cannot reproduce the problem on MediaWiki 1.22 anymore. So apparently the bug has been fixed in the meantime.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links