Page MenuHomePhabricator

Split the `legacy` feature on ResourceLoaderSkinModule into non-legacy manageable and reusable parts and deprecate use of the feature
Closed, ResolvedPublic

Description

Motivation: Improve performance of the new Vector skin ( T278896)

We should split the mediawiki.legacy.shared module into non-legacy manageable parts. It's over a thousand lines of CSS that is loaded on all pages and all skins. We can do better than that.

Doing that would hopefully allow us to only load some parts when they are actually used, or allow skins to override the styles using $wgResourceModuleSkinStyles.

Vaguely related:

Goal

To be done as part T281542

  • The ResourceLoaderSkinModule will throw a deprecation message when the legacy module is requested inside the constructor, with directions on which modules to use instead.

htps://github.com/wikimedia/mediawiki/blob/master/includes/resourceloader/ResourceLoaderSkinModule.php#L160

  • The legacy feature will no longer be used in any of Wikimedia-deployed skins and instead we will set sensible defaults from the new ResourceLoaderSkinModule features.
  1. The https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.skinning/legacy.less file will be deprecated and removed

Sign off notes

As of April 29th the legacy feature contains several styles that will not be carried over to the new interfaces.

  • Rules that are duplicated in the normalize feature e.g. sub,sup {line-height: 1;}
  • Rules that are duplicated in the interface feature e.g. .printfooter {display: none;}
  • True legacy rules. These include #mw-credits a, xdebug-error, mw-ajax-loader, mw-small-spinner, visualClear, mw-infobox-left, mw-infobox-right, .error, .warning, .success and mw-infobox. Extensions relying on these should be patched. If gadgets are using them we should move them to site/gadget styles.
  • Directionality rules for .mw-content-ltr and .mw-content-rtl which will now be applied via HTML dir attributes instead.
  • Directionality rules for input elements was dropped.
  • We dropped unused wbr element support and mark element (IE<11 support, T248061))
  • mw-label rules have been judged unnecessary. Will be moved to mediawiki.htmlform.styles during migration if learn otherwise.

Changes

The following changes were made in a backwards compatible way to ensure that existing skins continued to load the same styles as before. For specific situations where that's not the case please raise a bug.

  • Linker styles including mw-revdelundel-hidden styles were moved to mediawiki.interface.helpers.styles. This module now contains rules for minoredit, botedit and .autocomment
  • mw-revdel-checkbox rules were moved to mediawiki.special
  • wikitable rules are moved to a dedicated ResourceLoaderSkinModule feature. T278401
  • T232903: Deprecate Html::infobox (T268078) and make sure the styles relating to mw-infobox-left and mw-infobox-right are moved into the installer stylesheet.
  • A mediawiki.action.styles module was created for miscellanous UI-styles such as mw-warning-with-logexcerpt, #mw-clearyourcache, #mw-sitecsspreview, #mw-sitejspreview, #mw-usercsspreview, #mw-userjspreview, .previewnote (T278504, T278576). Styles for viewing an old revision were moved to a stylesheet loaded only when needed rather than for all page views (#mw-revision-info). .not-patrolled,div.patrollink, .unpatrolled,div.patrollink rules were added for handling patrol links. This also contains rules for ProtectionForm (T278576/T278504)
  • Styles for table of contents should be moved into the existing toc feature.
  • .mw-datatable rules are consolidated with resources/src/mediawiki.pager.tablePager/TablePager.less and resources/src/mediawiki.special/listFiles.less and removed from the ResourceLoaderSkinModule legacy file, so that they are only loaded when needed. T278374
  • category links were split out into an interface-category (note Minerva doesn't use these styles so they make sense as a separate feature) T278373
  • T269877: Drop thumbnail direction styles in legacy
  • The styles for #toolbar were dropped as part of T278563
  • Styles for mw-userlink, span.deleted, history-deleted and span.comment were moved to mediawiki.interface.helpers.styles
  • Styles for the editor relating to floats were moved to mediawiki.action.edit.styles module
  • Preferences for link underlining was moved to the new content.links feature (and for backwards compatibility this feature is loaded by legacy). This feature also contains plainlink and red link handling.
  • The .external.autonumber rules were grouped with other parser specific styles in the content.parser-output feature which may in future be named content.body

sign off steps

  • A task should be created about the removal of now deprecated styles e.g. .mw-infobox rules removed in T268194

Related Objects

StatusSubtypeAssignedTask
ResolvedReleasedancy
ResolvedJdlrobson
ResolvedJdlrobson
ResolvedJdlrobson
ResolvedFlorian
InvalidFlorian
ResolvedJdlrobson
ResolvedSBisson
Resolvedbd808
ResolvedJdlrobson
DuplicateNone
OpenNone
ResolvedMainframe98
ResolvedNone
ResolvedMainframe98
ResolvedMainframe98
ResolvedNone
ResolvedNone
ResolvedJdlrobson
ResolvedBUG REPORTJdlrobson
ResolvedJdrewniak

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

I'm... confused. As far as I can tell, the main skin-agnostic interface css appears to have been in 'legacy', whereas for whatever reason, 'interface' has historically and apparently still includes a lot of visual styles specific to monobook-like skins (header borders, colours and padding for things like thumbs, tocstyles, catlinks, etc), and thus cannot really be used outside of these. (But it also has stuff like the thumb icon links that every skin actually does need... and then has to reimplement, so that's annoying.)

Whereas 'legacy' is (was?) where most of the other skin-agnostic stuff like editlinks; visualclear (mostly used in content across many projects); skin-agnostic catlinks, wikitable, etc styles (inline display, spacing, no specific colours and borders and whatnot)? Am I understanding this right, that now anything that is not visually-compatible with monobook will no longer have common access to any of this? Or have the monobook etc visual styles been moved elsewhere?

None of the styles are actually being removed. All skins that work now will continue to be styled identically in future.The goal of this task is to move the legacy styles to more logical places and to allow more granular control where it makes sense. Skins will continue to have access to these styles, but will request them in a more logical manner. The legacy feature will become a shortcut for enabling all those new groups.

For example, if a skin wants to load the default styles for edit links they might load interface-edit-links instead of the legacy feature. If they want to provide their own edit links (e.g . want an edit icon pencil) they wouldn't. If they want the default table styles they'd load the table feature. if they want to provide their own styles for tables they wouldn't. Does that make sense?

The motivation here is that some kinds (Minerva) were choosing to provide difference styles to legacy, at the cost of essential styles that broke rendering for certain languages/pages.

Reedy renamed this task from Split the `legacy` feature on ResourceLoaderSkinModule into non-legacy manageable and reusable parts to Split the `legacy` feature on ResourceLoaderSkinModule into non-legacy manageable and reusable parts.Mar 26 2021, 1:23 PM

We are almost in a position we can wrap this up! So close! As far as I see the following are the remaining blockers:

NEEDS PATCH:

  • T278575 Create the content.links ResourceLoaderSkinModule feature, pulling code out of legacy
  • T278576 Remove non-critical path interface styles out of legacy feature into more appropriate homes

Awaiting merge:

  • T278504 Introduce the mediawiki.action.styles module
  • T269877 Split out ResourceLoaderSkinModule content feature into toc and content-thumbnails features

When those 4 land, I think it's safe to mark this feature as legacy, and make it throw a deprecated notice in the developer console. The defaults would also be adjusted.

After that, we can resolve this ticket and I suggest we roll this out in the new Vector modern skin, to reap the benefits of reduced critical path CSS and to aid testing across our projects for anything we overlooked before dropping it from all Wikimedia deployed skins.

Jdlrobson added a project: Web-Team-Backlog.
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Incoming to Needs Prioritization on the Web-Team-Backlog board.

Change 676005 had a related patch set uploaded (by Mainframe98; author: Mainframe98):

[mediawiki/core@master] Move legacy commonPrint styles to appropriate skin features

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

Change 676005 merged by jenkins-bot:

[mediawiki/core@master] Move legacy commonPrint styles to appropriate skin features

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

The work occurring on this task and related seems to have caused a regression in Timeless. See T279693. I would be surprised if other skins did not have the same issue. Please check that the file names are not being used by other skins.

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

[mediawiki/core@master] ResourceLoaderSkinModule: Change the recommended default

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

Given a few of the issues we've been having I suggest we move all deployed Wikimedia skins away from legacy during 1.37 and deprecate it in that release rather than rush it now.

Given a few of the issues we've been having I suggest we move all deployed Wikimedia skins away from legacy during 1.37 and deprecate it in that release rather than rush it now.

Or... fix legacy so it stops breaking all of them? Make it actually backward compatible per T280723, as a meta package for the split components, so that skins that were happy with it as-was don't immediately break? Because this isn't just affecting deployed Wikimedia skins, this is also breaking almost all other skins as well.

Make it actually backward compatible per T280723, as a meta package for the split components, so that skins that were happy with it as-was don't immediately break? Because this isn't just affecting deployed Wikimedia skins, this is also breaking almost all other skins as well.

The goal is for this to be backwards compatible so nothing "breaks" as part of 1.36

Lots and lots of care have been made wherever possible to make these changes backwards compatible. Note, a change in appearance should not be considered "broken" as shared resources are subject to change, but if the information is lost, text readability is impacted (e.g. black text on black background) that is something we will take very seriously.

Please open tickets and I will prioritize fixing and backporting those. I have commented on the ticket about the specific examples you have provided.

Jdlrobson renamed this task from Split the `legacy` feature on ResourceLoaderSkinModule into non-legacy manageable and reusable parts to Split the `legacy` feature on ResourceLoaderSkinModule into non-legacy manageable and reusable parts and deprecate use of the feature.Apr 22 2021, 3:50 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)

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

[mediawiki/core@master] ResourceLoaderSkinModule: `content`, `content-thumbnails` and `legacy` features are deprecated

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

Change 655170 merged by jenkins-bot:

[mediawiki/core@master] ResourceLoaderSkinModule: `content`, `content-thumbnails` and `legacy` features are deprecated

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

Krinkle reopened this task as Open.EditedAug 17 2021, 9:21 PM

I'm on latest mediawiki/core and skins/Vector, and all page views during development get:

This page is using the deprecated ResourceLoader module "skins.vector.styles.legacy". [1.37] The use of the content feature with ResourceLoaderSkinModule is deprecated. Use content-media instead. [1.37] The use of the content-thumbnails feature with ResourceLoaderSkinModule is deprecated. Use content-media instead. More information can be found at [[mw:Manual:ResourceLoaderSkinModule]].

The same is true in Beta and production as well. It is not unheard of deprecate in such visible way something that is used in production, for example of the feature in question has rare use cases that are difficult to find in search. But there are only a handful of skins, and which SkinModule attributes they use is trivially found in Codesearch so presumably that's not the rationale. As such, I assume it was a mistake to deprecate this and that it was probably thought that these are no longer used by production skins. If not, who is the deprecation meant to be seen by to act on. If for third-parties, it should perhaps be merged closer to the end of the release cycle, after the production uses are fixed.

Tentatively blocking next train per policy, especially since it's trivial to remove the deprecation line.

This ticket was not about deprecation it was about splitting up the file to prepare for deprecation. T287410 is the better ticket to track this concern. I'll copy it across there.

The message went here because this task is tagged with the deprecation that landed in core. Migration is usually not done within the train path, but we can track it there, sure.