Page MenuHomePhabricator

Highlight target references
Closed, ResolvedPublic

Description

Author: garyvdm

Description:
If you lick on the numbered link created by the <ref> tag, you are taken to the appropriate reference. If the article is smaller than the screen height, ie there is no vertical scrolling, it if difficult to see which reference you were looking for.

It is very easy to highlight the appropriate reference using the css :target selector. (Unfortunaly this is only supported by Gecko and Webkit browsers.)

The css we would need to add would look something like this:

:target
{
	font-weight:bold;
}

Version: unspecified
Severity: enhancement
URL: https://en.wikipedia.org/wiki/User:Garyvdm/monobook.css

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:33 PM
bzimport added a project: Cite.
bzimport set Reference to bz8303.
bzimport added a subscriber: Unknown Object (MLST).

ayg wrote:

JavaScript fallback would be good too for older browsers.

ayg wrote:

This requires some way of having Cite add CSS . . . note that Monobook's main.css currently just contains a rule for Cite in core. Not sure we want to add more of those (or keep the existing one). Is there some way for extensions to stick stuff in the autogenerated CSS without adding a whole new file?

This now exist, tested and work for Gecko (Firefox), WebKit (Safari), and Presto (Opear) based browser. Nope, doesn't work for Trident (IE).

ayg wrote:

It's a CSS change specific to the English Wikipedia. enwiki-specific changes have no bearing on Mediazilla bugs, which deal with the software as we ship it. Please test on a clean installation of MediaWiki next time, or at least on obscure wikis. Reopening.

Most (in fact: all wikis I tested) wikis have something like

ol.references > li:target,
sup.reference:target {
background: #def;
}

in their Common.css now, so it seems reasonable to include this directly with the extension.

(In reply to comment #2)

This requires some way of having Cite add CSS . . . note that Monobook's
main.css currently just contains a rule for Cite in core. Not sure we want
to
add more of those (or keep the existing one). Is there some way for
extensions
to stick stuff in the autogenerated CSS without adding a whole new file?

Now with RessourceLoader this is no longer any problem, in fact, a modules/ext.cite.css file already exists.

Change 196172 had a related patch set uploaded (by Gerrit Patch Uploader):
Highlight target references

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

He7d3r added a project: User-notice.
He7d3r set Security to None.
matmarex removed a project: Patch-For-Review.
matmarex removed subscribers: gerritbot, Unknown Object (MLST).