Page MenuHomePhabricator

Highlighting does not work if span with mw-cite-backlink class is removed
Closed, ResolvedPublic5 Estimated Story Points

Description

The current jump mark highlighting relies on the default reference link format containing the mw-cite-backlink CSS class:

<li id=\"$1\"$4><span class=\"mw-cite-backlink\">↑ $2</span> $3</li>

Since this is part of a i18n message it can be altered and overwritten. This happened for example on en.wikipedia.beta. [1]

[1] https://en.wikipedia.beta.wmflabs.org/w/index.php?title=MediaWiki:Cite_references_link_many&action=edit&oldid=8998

Event Timeline

WMDE-Fisch triaged this task as Medium priority.Nov 27 2018, 3:20 PM
WMDE-Fisch created this task.

It looks like your code also breaks on some changes to MediaWiki:Cite_references_link_many_format. Specifically, if all the formatting is inside the link instead of wrapping the link, as was the case in https://en.wikipedia.beta.wmflabs.org/w/index.php?title=MediaWiki:Cite_references_link_many_format&oldid=9002 for example, it doesn't find the links.

Change 476246 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Cite@master] Make backlink highlighting robust when "mw-cite-backlink" is missing

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

Change 476246 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Make backlink highlighting robust when "mw-cite-backlink" is missing

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

Demo:

On en.beta [1] I currently have the link format from ja.WP [2] with missing mw-cite-backlink class laoded [3]. - With the latest improvements the added arrow up backlink still works with the multiple reference [1].

[1] https://en.wikipedia.beta.wmflabs.org/wiki/Cite_web_test
[2] https://ja.wikipedia.org/w/index.php?title=MediaWiki:Cite_references_link_many&action=edit
[3] https://en.wikipedia.beta.wmflabs.org/w/index.php?title=MediaWiki:Cite_references_link_many&action=edit

We could consider backporting this so it's deployed before end of next week.

thiemowmde set the point value for this task to 5.Dec 4 2018, 9:49 AM

For the record, on frwiki I have changed the classname back to the regular name (refs Cite references link one, Cite references link many), as I think it's the only proper way to handle this. The classname just shouldn't had been allowed to be renamed in the first place. Triggered by the custom name, these subsequent JavaScript workarounds were in turn causing some bug in gadget ReferenceTooltips...