Page MenuHomePhabricator

Missing tooltip of images (title="" not specified)
Closed, ResolvedPublic


Author: WIKImaniac

case 1: No tooltip is shown:
[[Image:Qsicon Exzellent.svg|x16px|link=Wikipedia:Exzellente Artikel|tooltip]]

case 2: Tooltip is shown if there is no hyperlink:
[[Image:Qsicon Exzellent.svg|x16px|tooltip]]

case 3: Hyperlink an tooltip is shown:
Image:Qsicon Exzellent.svg|x16px
default [[Wikipedia:Exzellente Artikel|tooltip]]
desc none

I would prefer to get the result of case 3 by using syntax of case 1.

Version: 1.14.x
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:24 PM
bzimport set Reference to bz16912.
bzimport added a subscriber: Unknown Object (MLST).

Case 3 is probably specific to [[mw:Extension:ImageMap]], while the first two use cases are in MediaWiki core.

Wiki.Melancholie wrote:

Note that, although alt="tooltip" is available in source code and thus probably shown as fallback tooltip with IEs, all other web browsers rely on title="tooltip" to be specified. But title="" is missing.

ayg wrote:

*** Bug 17044 has been marked as a duplicate of this bug. ***

ayg wrote:

The HTML for case 1 looks like

<a href="" title="commons:"><img alt="Commons" src="" width="31" border="0" height="41"></a>

The unnamed parameter is eaten in favor of the default link tooltip. This is wrong. This is probably a simple change to Parser::makeImage() to fix; it might be necessary to look a couple of levels down at the stuff it calls.

allstarecho wrote:

Any progress 5 months later on this issue?

Created attachment 6116
Patch to set a's title= for [[Image:..|link=]]

I've been hunting around, and I think this patch should fix the problem. The code is untested, because i don't run a mediawiki installation, but should be easy to verify.


ayg wrote:

  • $linkAttribs = array( 'href' => $options['custom-url-link'] );

+ $linkAttribs = array( 'href' => $options['custom-url-link'], 'title' => $alt );

This wasn't right -- it was adding an empty title if the alt text was empty, which I don't think we want. Other than that, it tested out fine. Committed as r50641.

allstarecho wrote:

So does that mean it's fixed? It's still not working at in the examples there.

...which would be because Wikipedia isn't running r50641 yet, see [[Special:Version]] (currently at r48811).
But still, it will be available fairly soon.

ayg wrote:

It will be available (assuming all goes well) at the next scap, which may or may not be fairly soon. The last scap was close to two months ago, and who knows when the next one will be. But it should work when [[Special:Version]] gets to r50641 or later.