Page MenuHomePhabricator

InfoAction should have unique CSS hooks for each field
Closed, ResolvedPublic

Description

Somewhat related to bug 42629, the table rows at action=info should have unique CSS IDs so that they can be targeted with the CSS target pseudo-selector. In particular, I'd like to be able to highlight the "Number of watchers" row, though having IDs for all of the rows would probably be nice.


Version: 1.22.0
Severity: enhancement

Details

Reference
bz44252

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 1:33 AM
bzimport set Reference to bz44252.

(In reply to comment #0)

Somewhat related to bug 42629, the table rows at action=info should have
unique
CSS IDs so that they can be targeted with the CSS target pseudo-selector. In
particular, I'd like to be able to highlight the "Number of watchers" row,
though having IDs for all of the rows would probably be nice.

Highlight for what reason?

We're not going to add random IDs everywhere just to enable users to hang up more circus decoration.

If you're looking for alternate styling, the table could have a distinguishing class (e.g. ".mw-infoaction-table") and use something like .mw-infoaction-table tr to give the rows special styling (e.g. alternating row highlighting or whatever).

But individual IDs seems very selective and overkill, at least without a proper use case.

(In reply to comment #1)

Highlight for what reason?

There's a link to the number of watchers from &action=history on many wikis. This goes to a page such as https://toolserver.org/~mzmcbride/watcher/?db=enwiki_p&titles=Apple+Inc. currently, where there's a lot of signal and little noise and it's easy to see the value that the user is interested in (because it's nearly the only information on the page).

Compare to <https://en.wikipedia.org/w/index.php?title=Apple_Inc.&action=infoBasic_information>, which is the most targeted a link can be currently from &action=history (yes, two ...). With this link, the target (the number of page watchers) gets lost after the user visits the info page. Highlighting that specific table row when there's an ID of #mw-info-page-watchers or similar would be a nice improvement, I think. This could be done with local CSS on wikis such as the English Wikipedia and Meta-Wiki. However, no highlighting or more specific targeting can take place with the current HTML structure, as far as I'm aware.

We're not going to add random IDs everywhere just to enable users to hang up
more circus decoration.

I'm only interested in highlighting the watchers row.

https://en.wikipedia.org/wiki/Barack_obama?action=info

Is there a good way to select only the "Number of page watchers" table row in CSS or JavaScript? I want to highlight it from a particular hyperlink using an anchor (similar to how <ref></ref>s have a light blue background on some wikis). This requires being able to select only that table row. Is this possible currently?

(In reply to comment #3)

https://en.wikipedia.org/wiki/Barack_obama?action=info

Is there a good way to select only the "Number of page watchers" table row in
CSS or JavaScript?

Not right now. If you're looking for a quick solution, '#mw-content-text .mw-page-info:first-of-type tr:nth-of-type(8)' will do the job for now, but it'll break if any rows are removed or added or if the order changes.

You could probably cook up some XPath selector to find a table cell with 'Number of page watchers' inside and return the next one (there is some way of using it in JS I'd have to look up), but I don't know it enough to be helpful here.

I want to highlight it from a particular hyperlink using
an
anchor (similar to how <ref></ref>s have a light blue background on some
wikis). This requires being able to select only that table row. Is this
possible currently?

If you want to use the :target pseudoclass (which would be the right way, and it's how the <ref> highlighting is done), the table row would have to have an ID. If in JavaScript, see above.

(In reply to comment #4)

If you want to use the :target pseudoclass (which would be the right way, and
it's how the <ref> highlighting is done), the table row would have to have an
ID. If in JavaScript, see above.

An ID also helps with jQuery. I think Krinkle was worried there wasn't a reasonable use-case here. I believe there is, so I'm adding the "easy" keyword accordingly. This is a trivial change.

Implementing this change would allow me to begin the deprecation process for the watcher tool.

Related URL: https://gerrit.wikimedia.org/r/70028 (Gerrit Change Id4fd17e748c0fe3a9f4c51846abcaa8942fa5c50)

Change 70028 merged by jenkins-bot:
Add ID to action=info table rows

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