Page MenuHomePhabricator

Remove UseLegacyMediaStyles, change loading pattern and deprecate
Closed, ResolvedPublic

Description

Background

wgUseLegacyMediaStyles = true results in skins shipping additional CSS to support legacy templates. For most pages this CSS is unused. These styles should be limited to the templates that need them and need updating.

User story

  • Add user story in the format: “As a [persona], I want to [X], so that [Y]”

Requirements

  • Only load the styles on pages that need them

BDD

  • For QA engineer to fill out

Test Steps

  • For QA engineer to fill out

Design

  • Add mockups and design requirements

Acceptance criteria

  • Add acceptance criteria

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

This task was created by Version 1.2.0 of the Web team task template using phabulous

Event Timeline

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

[mediawiki/core@master] Skins: Drop temporary UseLegacyMediaStyles in favor of on demand loading

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

Jdlrobson-WMF renamed this task from Move UseLegacyMediaStyles out of skin styles to Move UseLegacyMediaStyles out of skin styles and deprecate.Apr 28 2026, 5:45 PM
Jdlrobson-WMF renamed this task from Move UseLegacyMediaStyles out of skin styles and deprecate to Remove UseLegacyMediaStyles, change loading pattern and deprecate.

Rough plan:

  • Implement {{#media:content=....}} as a new parser function (T318433#10397735) to allow migration of content using the existing legacy DOM structure.
  • Document new parser function & recommended conversion for editors on wiki, send note to Tech News with deadline for conversion
  • Add something like if ( (strpos( $out->getHtml(), 'thumbinner' ) ) { $out->addModule('skins.legacythumbs.deprecated'); } (similar pattern as used for mw-ui-button)
  • Set $wgUseLegacyMediaStyles = false in production
  • Remove this code from 1.47

We plan to defer this until Parsoid Read Views rolls out to enwiki so that the {{#media}} parser function doesn't have to be implemented for the legacy parser and can be Parsoid-only.

Add something like if ( (strpos( $out->getHtml(), 'thumbinner' ) ) { $out->addModule('skins.legacythumbs.deprecated'); } (similar pattern as used for mw-ui-button)
Set $wgUseLegacyMediaStyles = false in production

I recommend we combine these two steps (and actually remove $wgUseLegacyMediaStyles - they are the same). There is no need to remove in 1.47 since this was clearly flagged as a temporary flag, and not stable.

I would also recommend doing the addModules first as this is a performance issue for ALL readers so I think it is a priority to fix. Again, it should have no impact on your plan.

We can rephrase that. My intention was that step was "make use of the deprecated module visible to editors". I think you suggested adding some sort of warning to the console when skins.legacythumbs.deprecated was loaded.

Does this sound good?

Rough plan:

  • Add something like if ( (strpos( $out->getHtml(), 'thumbinner' ) ) { $out->addModule('skins.legacy.thumbs'); } (similar pattern as used for mw-ui-button). Drop $wgUseLegacyMediaStyles = false usage in production
  • Implement {{#media:content=....}} as a new parser function (T318433#10397735) to allow migration of content using the existing legacy DOM structure.
  • Document new parser function & recommended conversion for editors on wiki, send note to Tech News with deadline for conversion
  • Deprecate skins.legacy.thumbs and point to the phab/mw.org migration guide
  • Remove this code from 1.47

We plan to defer this until Parsoid Read Views rolls out to enwiki so that the {{#media}} parser function doesn't have to be implemented for the legacy parser and can be Parsoid-only.

Change #1278517 merged by jenkins-bot:

[mediawiki/core@master] Skins: Drop temporary UseLegacyMediaStyles in favor of on demand loading

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

Doh looks like a caching issue since the styles have moved out of the skin modules to a new module. Purging page will update it. Unfortunately hard to retroactively fix this now. Sorry, @Izno for creating unnecessary work for you!

It will fix itself by Thursday 4th June everywhere on 100% of pages but is likely fixed on the majority of page views at this point in the case of English Wikipedia (since pages change more frequently). If you want to avoid complaints until then you can add the following to MediaWiki:Common.js.

/* Can be deleted after Thur 4th June 2026  (T424687) */
if ( $('.thumbinner,.floatleft,.floatright').length && mw.loader.getState('mediawiki.skins.legacy') !== 'ready' ) {
    mw.loader.load('mediawiki.skins.legacy');
}