Page MenuHomePhabricator

Community expectation that mw-datatable styles are loaded on pages which use it
Closed, DeclinedPublicBUG REPORT

Description

What happens?:

Reported at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)/Archive_191#class=mw-datatable_no_longer_working_in_Firefox (archived discussion).

Historically styles applying to mw-datatable were loaded on all pages as part of the legacy stylesheet. They have since moved to the mediawiki.pager.tablePager module.

It appears they are used in wikitext, but this was not documented in the code.

This has never worked on the mobile site.

What should have happened instead?:

If this is a community expectation, we should conditionally load the styles based on whether the element is in the page similar to how the mw-collapsible class works. [1]

If we need further time to think through whether this should be supported officially, we may want to add this conditional in the interim time to the Monobook and Vector skins.

[1] https://gerrit.wikimedia.org/g/mediawiki/core/+/c0a326408d113b67bba43bb8092d17fec3a57daa/includes/skins/Skin.php#308

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

  • Modern Vector is impacted NOW
  • Modern, CologneBlue and MonoBook will be impacted during the 3rd August deploy.
  • Legacy Vector will be impacted during the 10th August deploy.

Developer notes

Editors can add the following to their user scripts to workaround this issue while it is open:

mw.loader.load('mediawiki.pager.tablePager');

Event Timeline

Change 709830 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Conditionally load mw-datatable styles where needed

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

@Krinkle do you know anything about the history of the mw-datatable class? Was it expected to be used in templates/wikitext? If so I think the above patch is the way forward.

I suspect this ticket will get more attention on Thursday when the styles will disappear from MonoBook, so we might want to backport this tomorrow if we think this is the approach going forward.

Thanks Jdlrobson for the Phabricator ticket. class=mw-datatable is used in a lot of tables. People like it for 2 reasons:
1: The row highlighting on hover.
2: The white background for non-header cells. It makes for more contrast especially when there are non-bolded links in the non-header cells. The blue links against the normal gray background of non-header cells are not very contrasting. Bolded blue links against the gray background of header cells are less of a problem, though I think the gray background of headers is too dark of a gray. class=mw-datatable is often used with class=wikitable and the gray header background of class=wikitable overrides the blue background of class=mw-datatable

See: https://en.wikipedia.org/wiki/Help:Table?useskinversion=2&useskin=vector#mw-datatable_%E2%80%93_row_highlighting_via_cursor_hover._White_background

Thanks Jdlrobson for that link since it forces the use of the Vector skin where the problem currently lies in Firefox. That Help:Table section shows how the 2 table classes look separately and together. It is working fine for me in Chrome and Edge.

Contrary to Timeshifter's claim that mw-datatable is used in a lot of tables, it is currently in 334. In contrast, wikitable is in some 600k. (That's ignoring templates, where I assume wikitable also dominates.)

I guess you pinged Krinkle because he's the one who made it appear in 2011: rMWf98a0ec075294df1bc7c9f70ca6a979137a26687

The class seems largely to duplicate wikitable without obvious reason? Apparently solely for special pages and the like, without the guarantee that wikitable will be present if it should sneak into user code. Which, as I noted yesterday, is not obviously the intent for the class... (sounds like some center and floatright action ;D). If it should be preserved, it should be preserved as a modifier on wikitable (.wikitable.mw-datatable) and solely add the hover over effect rather than make any other modifications to the relevant CSS, and then replace its uses in the general.

I guess? I realize that's more work. :^)

Krinkle has suggested on Gerrit that we decline this ticket, and instead move those tables across to wikitable/or a template+template style / site style. Given the low usage, that seems like the right call here @Izno. Does that work for you?

Note, refreshing wikitable styles is on our roadmap, so perhaps as part of that some of its behaviour could be expanded in the future (and informed by such template/site styles), but probably at least a year away

It is in 43 templates too. And the articles those templates are used in are NOT listed in the 334 results from the Izno search. I checked.

For example; the 107 articles using Template: Static row numbers table

Change 709830 abandoned by Jdlrobson:

[mediawiki/core@master] Conditionally load mw-datatable styles where needed

Reason:

More discussion needed on ticket.

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

I edit Help:Table and people ask about how to do row highlighting. The info was only relatively recently added to Help:Table. But it is rapidly being used by more and more tables. It would be a shame to lose this very useful function. It is difficult sometimes to follow a row of data across a wide table. Row highlighting on hover makes it much easier. And the white background of mw-datatable makes the light blue hover color stand out. And thus easier to follow across the row.

I edit Help:Table and people ask about how to do row highlighting. The info was only relatively recently added to Help:Table. But it is rapidly being used by more and more tables. It would be a shame to lose this very useful function. It is difficult sometimes to follow a row of data across a wide table. Row highlighting on hover makes it much easier. And the white background of mw-datatable makes the light blue hover color stand out. And thus easier to follow across the row.

The hover can be added with one line of CSS. However, it's not for me to say whether it makes sense to include that inside a template or inside MediaWiki:Common.css. It also should ideally use its own distinctive class e.g.mw-wikitable-data

.mw-wikitable-data tr:hover td,
.mw-datatable tr:hover td {
    background-color: #eaf3ff;
}

Whatever solution is found now or in the future I like the choice of 2 background colors for non-header cells:

  1. Light gray is useful for tables that basically just hold text, quotes, and so on. Right-floating quotes for example. The gray helps separate the quote box from the article text.
  1. White background for all the non-header cells in typical tables. It makes tables so much easier to read. At least for me. Especially when there are links in the table.

@Timeshifter I've added a TemplateStyles-based version to COVID-19 Netherlands medical case as example. How's that?

I would strongly recommend against adding it to millions of pages under the belief that tables should be white by default, however. I would instead recommend in that case that you create a task and talk with the Wikimedia Design Team and their User Experience experts to explain your thoughts and see about improving wikitable by default in the software and for all wikis. I think you make a good point about readability and this could as such benefit from an efficient default approach without having to go through a lot of work to update the entirety of Wikipedia by hand!

Krinkle has suggested on Gerrit that we decline this ticket, and instead move those tables across to wikitable/or a template+template style / site style. Given the low usage, that seems like the right call here @Izno. Does that work for you?

No big personal opinion on my point. I think 'degrades gracefully' is a prettty reasonable approach in the immediate timeframe.

From a TemplateStyles perspective, T176272: Decide on what to recommend for table style usecase is still hanging around with its first-sentence caveat.

From memory I think a 'hover over' for table rows has been rejected from en.wp's Common.css. I would guess other wikis have something hanging around though. I wouldn't say that many.

Modest search results in code search so some task looking at the utility of hovers might be interesting.

This would have to be fixed first before generally applying row hover highlighting along with a white background to all tables:
T284802: class=mw-datatable should not override the inline background colors set for specific table rows. .

In the meantime I don't see why we don't keep mw-datatable. It's not hurting anything. And no one is going to mass add it to individual pages. And in any case it degrades gracefully. If a general solution comes up it will do the same thing as mw-datatable. At least the hover part.

I like the white background as much as the hover part. So I like having a specific class to do that: mw-datatable. It works now in templates. It allows me to apply it to individual pages too. To test it, and see where there are problems (such as T284802). Waiting for some Wikimedia committee to do a general solution could take years. People need to see it in use. Eventually the Wikimedia cabal (kidding) may come around.

On the historical question about Who did permit projects to use this feature (“It appears they are used in wikitext, but this was not documented in the code.”):

  • English Wikipedia documented the class in 2016.
  • German Wikipedia documented the class in 2012.
  • mw:Help:Tables #See also refers to the more elaborated enWP help page right now.

The expectation of the communities is that this is a feature supported on any page without any precaution.

Otherwise please provide a link to the MediaWiki class name dictionary where it is listed which classes are released for public usage and which must not be used by authors.

I think that mw-datatable is a useful feature, especially for larger tables with row highlighting. And I do agree with @Timeshifter. It's not hurting anything. So, I believe that this style should be kept until a suitable replacement for it is made available.

Untagging Vector as this impacts all skins

On the historical question about Who did permit projects to use this feature (“It appears they are used in wikitext, but this was not documented in the code.”):
The expectation of the communities is that this is a feature supported on any page without any precaution.

According to my logs it was added in 2011 by @Krinkle to core in f98a0ec0752. I see nothing in the commit message about intention for this to be used on-wiki via wikitext.

It's not hurting anything

Including this style adds 1.46kb of render-blocking CSS to all page views. It's small but it adds up and slows down viewing the site for many users with less capable internet connections or devices.

https://gerrit.wikimedia.org/r/c/709830 makes this conditional to limit the loading of those styles to pages that need it, but given those styles are intended for a specific part of the MediaWiki interface I'm still not 100% convinced it makes sense to conflate the two concepts for a hover rule and background color.

Questionnaire back:

  • If you make a questionnaire in the backyard of Phabricator, where nobody will take notice of that, why are you not waiting for answers?
  • If you make a questionnaire on “Community expectation” why are you not asking via Tech News and village pumps of some major wikis?
  • If you make a questionnaire on “Community expectation” why do you not wait for any answer but remove the feature immediately?
  • If you plan to follow a new strategy what has been so darely urgent that you cannot wait for answers after broadcasting your questionnaire to the communities, to get something removed within a few days which was present for a decade?
  • If you plan to follow a new strategy why did you not check en:Help:Table first, where this has been advertised since 2016? Why did you not check mw:Help:Tables where the enWP is recommended for more details? Why did you not make a simple Cirrus search on enWP within all namespaces? Why did you fail to make any investigation first before removing this feature?
  • Since you watch your steps carefully why did you fail to make an announcement in Tech News first and require removal of a feature propagated for many years and used rather widely in various projects? Giving time to communities to update their content and templates? Did you ever hear the term “migration”?
  • Why are you making a breaking change without being aware that this is a breaking change?
  • Who else than you personally has made the decision to remove this feature? Why did the reviewer fail to check whether this can be removed without disruptive change? Who authorized you to make such decisions as a single person, and without the necessary investigations first?

OK, so right now, we've gotten rid of the mw-datatable style with no suitable replacement to it?

OK, so right now, we've gotten rid of the mw-datatable style with no suitable replacement to it?

Replacement:

I've added a TemplateStyles-based version to COVID-19 Netherlands medical case as example. How's that?

Template:Import-blanktable

@Krinkle wrote up a template style to add row hover highlighting and a white background. See: Template:Import-blanktable

I tested it on the examples in the task description. It works fine. […]

Who will do the job in replacing that in thousands of arcticles and many templates?

On those wikis with no bots, no technically experienced authors, expressed by no interface administrators – who will introduce TemplateStyles and modify all affected pages?

And once again: After advertising this capability on en:Help:Table in 2016 and recommending this page for details by MediaWiki – which person next to god has been authorized to remove this CSS from the public?

And where is the task where it has been discussed in advance? Who agreed, who argued against? Who made the decision?

From T284802 the MW UI developers had knowledge that this class is used in content pages, and obviously in many pages.

  • Nevertheless some people decided to break these pages deliberately. In communities such behaviour is called “vandalism”.
  • No announcement has been made in Tech News and village pumps, no migration period of several months with a deadline and instructions and explanation.
  • What is the crucial performance bottleneck which made it inevitable to remove that code immediately, from one week to the other, without any prior information?

It is fine with me if you decrease user bandwith by delivering a module if and only if that class is occurring in HTML output, similar to mw-collapsible and mw-sorting (both officially usable even never provided on mobile).

  • Note that they require JavaScript to work on client side and they check the HTML DOM on client side, then pulling the resources.
  • mw-datatable is CSS only, it is to work even with inactive JavaScript. Therefore eavesdropping on server side is required, at the HTML assembly of cache contents and wrapping skin.
  • A good developer would have provided this mechanism first, then testing on BETA/testwiki whether it works, removing the unconditional CSS after prove that it is a sufficient solution. Nobody outside would have taken notice ever.

class=srn-datatable has been added to Template:Static row numbers and Template:Static row numbers table

Hover highlighting is working fine, and has been tested in multiple skins and tables. It does not override cell or row background colors. See discussion:
Template talk:Static row numbers#Row hover highlighting

Do tests yourself in edit mode here:
User:Timeshifter/Sandbox152

So this is the top 2 lines of table wikitext that is needed to add row numbers and hover to most tables with one header row:

{{static row numbers}}
{| {{static row numbers table}}

See many examples here:
Special:WhatLinksHere/Template:Static_row_numbers_table

I always liked using datatable on tables, and apparently I was not alone on dewiki: more than 2,000 pages there use the feature. The suggestion to work with TemplateStyles does not help, as we cannot simply make templates out of all the individual tables. Please bring back the functionality asap!

I always liked using datatable on tables, and apparently I was not alone on dewiki: more than 2,000 pages there use the feature. The suggestion to work with TemplateStyles does not help, as we cannot simply make templates out of all the individual tables. Please bring back the functionality asap!

You don't make templates for all the individual tables. You make a template the only content of which is a TemplateStyles tag, define your CSS in the sheet, and then add that template above each of the tables and the defined class to the table.

Yeah, currently we are advised against using TemplateStyles that way. And as PerfektesChaos already pointed out, who is going to insert that template in more than 2,000 pages now?

Perhaps we could replace mw-datatable to tpl-blanktable on the important articles first.

Who is going to determine what are “important articles” and by which criteria? Without a replacement strategy, this change should have never been done in the first place. If it can’t be undone easily, I will propose a local replacement via Common.css on dewiki (at least for the row highlighting, which in my experience is the main reason why it is used). But I guess that cannot be a permanent solution.

Yeah, currently we are advised against using TemplateStyles that way. And as PerfektesChaos already pointed out, who is going to insert that template in more than 2,000 pages now?

Advised against that on the extension page but that task is still open now and it was clearly allowed in the initial design and deployment - it doesn't take long to find that discussion. Inserting the template is a bot or AWB task that will take a couple hours at most and then you'll have the benefit of TemplateStyles for this... vice the prior way of loading (which was expensive for all pages) or Common.css, which *was* noted as another alternative earlier on this task.

The alternative I favor is eliminating the class entirely and the row hover (which I am pretty sure is the reason it is used) be added to wikitable as an optional class like wikitable-hover, but that is some more work of course.

I hate to repeat myself.

Who will do the job in replacing that in thousands of arcticles and many templates?

On those wikis with no bots, no technically experienced authors, expressed by no interface administrators – who will introduce TemplateStyles and modify all affected pages?

How will your all-wiki-bot change template programming?

Why was this deliberately executed breaking change not communicated in advance, with migration period and deadline?

What was the crucial need to remove this widely used feature from one week to another?

Where do I find the task where precisely this breaking change has been discussed in advance? Who made that decision? Who is the responsible Product Manager?

I hate to repeat myself.

Who will do the job in replacing that in thousands of arcticles and many templates?

On those wikis with no bots, no technically experienced authors, expressed by no interface administrators – who will introduce TemplateStyles and modify all affected pages?

How will your all-wiki-bot change template programming?

I have been working on MediaWiki:Common.css, basically by myself. You will find a way. In fact, it could have been fixed by now if any of the half-dozen people here who wanted to did replace it. To put some numbers on it, de.wp, which surely is not one of the wikis with no bots, technically experienced authors, or interface administrators (why do you need to be one of those again?) uses it 2.2k times in a subject space. Conversely, there are only some 4.7k total in all subject spaces across all wikis.

Are you actually concerned for all those wikis who have now lost global mw-datatable, or are you simply making rhetoric? Because that's a bare 2.5k that aren't de.wp in a subject space. Where the experience degraded gracefully to either wikitable or an unstyled table.

As I said, it could have been fixed by now, globally, if someone cared enough.

Why was this deliberately executed breaking change not communicated in advance, with migration period and deadline? [snip]

I did not answer these questions because I do not know the answers. You did not need to repeat unanswered questions for no reason.

The blatant “who cares?” attitude shown on this task makes it hard for me to comment any further. But anyway, let’s wait until someone answers the obvious question on why this change was not announced the way it should have been. Then we might think about a local solution. Just further cluttering the common stylesheet of dewiki after every new bug should be avoided.

Row highlighting on hover has been added to Template:Static row numbers. See:
Template_talk:Static_row_numbers#Row_hover_highlighting

class=srn-datatable has been removed from it. The optional class=srn-white-background has been added to it. It is currently being used in Template:Static row numbers table

{{Static row numbers table}} has been tested in edit mode in User:Timeshifter/Sandbox152. Row hover and white background both work without problems. It does not override cell, nor row, background colors. See also:
Pages that link to "Template:Static row numbers table"

mw-datatable would override background colors set for rows, but not background colors set for individual cells. See: T284802. class=mw-datatable should not override the inline background colors set for specific table rows.

So the static row number templates are working better than when they used class=mw-datatable

I'll chip in as an editor fond of using mw-datatable (having only recently heard of its discontinuation):

I always liked using datatable on tables

Me too, @XanonymusX.

I think that mw-datatable is a useful feature, especially for larger tables with row highlighting.

I do too, @Eric0892. Not only useful but paramount for people with less than perfect eyesight. I always saw it as an accessibility functionality.

The class seems largely to duplicate wikitable

Is it? I don't recall it working without wikitable.

If it should be preserved, it should be preserved as a modifier on wikitable (.wikitable.mw-datatable)

That's how I always used it and saw it being used: class="mw-datatable wikitable".

The alternative I favor is eliminating the class entirely and the row hover (which I am pretty sure is the reason it is used) be added to wikitable as an optional class like wikitable-hover, but that is some more work of course.

So, we're basically replacing wikitable-hover for mw-datatable, twelve for a dozen, waiting for some more work to be completed, for what?

The class seems largely to duplicate wikitable

Is it? I don't recall it working without wikitable.

Yes, its styles do not require .wikitable. See the .less files in this search.

If it should be preserved, it should be preserved as a modifier on wikitable (.wikitable.mw-datatable)

That's how I always used it and saw it being used: class="mw-datatable wikitable".

Because it was being used outside its intended scope. Subsequently causing this task when it was removed from loading in the places outside its intended scope.

The hover can be added with one line of CSS. However, it's not for me to say whether it makes sense to include that inside a template...

Like that?

Seems like the template based solutions are the way to go here. We have a lot of examples of where sharing code between skins and templates has been problematic ( hlist, interface message boxes e.g. errorbox) so I am going to be bold and decline this.