Page MenuHomePhabricator

Add HTML classes for links in .mw-usertoollinks
Closed, ResolvedPublic

Description

On Recentchanges, Watchlist, history and other places (I think MediaWiki calls them ChangesList), there are span elements with the class mw-usertoollinks that contain links. These links do not have any classes on them. This makes it unnecessarily difficult for users who want to want to do something with these links with CSS and/or JavaScript. You can't target them by text because users have different user languages. You can't target them by href or title because of different content languages. And finally, you can't target them by index because the contribs link for anonymous users is where the link to the user page is for logged-in users.

Related: T102013

Details

Related Gerrit Patches:

Event Timeline

Nirmos created this task.Feb 1 2017, 12:31 AM
Restricted Application added subscribers: TerraCodes, Aklapper. · View Herald TranscriptFeb 1 2017, 12:31 AM

@Nirmos: This task sounds broad due to "and other places" and not too self-contained. So I'm not sure it fits the criteria of good first task currently?

These links do not have any classes on them.

Do you ask for more classes? Or actually IDs?

https://gerrit.wikimedia.org/r/#/c/328943/ might be example code for adding IDs.

Nirmos added a comment.Feb 2 2017, 1:51 AM

This task sounds broad due to "and other places" and not too self-contained.

As I said, I'm pretty sure these are collectively called ChangesList in MediaWiki, so an edit in only one file should be sufficient.

Do you ask for more classes?

The links currently have 0 classes. I'm asking for 1 class to be added to each link. Looking at similar links, these would probably be called something like mw-changeslist-talklink, mw-changeslist-contribslink and mw-changeslist-blocklink, although what they end up being called is not terribly important to me.

Or actually IDs?

IDs are not applicable here. An HTML ID may only appear once per page. There are by default 50 of these links on Recentchanges, history etc, but it can be changed.

Legoktm added a subscriber: Legoktm.Feb 2 2017, 1:52 AM

The code that makes userlinks is actually in Linker.

EddieGP claimed this task.Feb 17 2017, 10:53 AM
EddieGP triaged this task as Medium priority.
EddieGP added a comment.EditedFeb 17 2017, 12:26 PM

Have a working patch, just trying to also solve T102013 here.
Edit: That didn't work out, links for diff & hist aren't centralised at Linker.php as userlinks are. Submitted a fix for this bug only.

Change 338350 had a related patch set uploaded (by EddieGP):
Adds css classes for userlinks on Specialpages

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

Change 338350 merged by jenkins-bot:
Add CSS classes for userlinks on SpecialPages

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

EddieGP closed this task as Resolved.Feb 23 2017, 9:49 PM