Page MenuHomePhabricator

Loading styles from module "mediawiki.pager.styles" shouldn't have side-effect on display of Watchlist page
Closed, ResolvedPublicBUG REPORT

Description

The module mediawiki.pager.styles (code, compiled CSS) is loaded on pages such as:

On the other hand, it is not loaded on:

Problem is:
When loading these styles on the Watchlist page – do mw.loader.load('mediawiki.pager.styles') – it has some side-effect, in particular it hides the edit time, due to this rule:

.mw-changeslist-time {
  display: none;
}

Expected:
Loading this additional styles module shouldn't have side-effects on the page.

Use case:
I'm working on gadgets that dynamically fetch and embed extracts of remotes pages (history, user contributions, etc.) into the interface, adding styles (from mediawiki.diff.styles, mediawiki.interface.helpers.styles, etc.) as required, and loading extraneous CSS shouldn't have effect on rendering.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
kostajh subscribed.

Thanks for filing this @Od1n. Do you plan to work on this?

Here is an extract of the markup in History and User contributions pages:

section.mw-pager-body
    ul.mw-contributions-list
        li[.unrelated-classes]
            span.mw-changeslist-time (text content: 14:15) [hidden]
            a.mw-changeslist-date (text content: 14:15, 14 March 2022)

and in Watchlist page:

div.mw-changeslist
    ul.special
        li.mw-changeslist-line
            span.mw-changeslist-line-inner
                span.mw-changeslist-date.mw-changeslist-time (text content: 14:15)

Therefore, I could figure out two solutions:

Solution A:

.mw-contributions-list .mw-changeslist-time {
  display: none;
}

Solution B:

.mw-changeslist-time:not(.mw-changeslist-date) {
  display: none;
}

I would pick solution B:

  • Solution A should be less robust. For example, it would fail if some script (or new MediaWiki feature) groups the contributions by day, like in the watchlist, in the process changing the lines to use the same markup.
  • Solution B sounds appropriate:

Change 772825 had a related patch set uploaded (by Gerrit Patch Uploader; author: Jean Culefort):

[mediawiki/core@master] Do not hide the "time" element if it also carries the "date" role

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

Note that this seemingly-unused always-hidden "time" element was created via T298639. It is planned to be used once T293268 is finished.

Thanks for the patch @Od1n! (I assume that's you) Your explanation makes perfect sense.

Change 772825 merged by jenkins-bot:

[mediawiki/core@master] Do not hide the "time" element if it also carries the "date" role

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

The change will be deployed to Wikimedia wikis tomorrow (because of the daily-train experiment: https://www.mediawiki.org/wiki/Wikimedia_Release_Engineering_Team/Trainsperiment_week).