Page MenuHomePhabricator

Allow skins to change the pages used in user.js/css via hook
Closed, DeclinedPublic

Description

We currently have the hooks ResourceLoaderSiteModulePages and ResourceLoaderSiteStylesModulePages to allow us to change which pages apply.

This is used in MobileFrontend to apply MediaWiki:Mobile.css and MediaWiki:Mobile.js instead of Mediawiki:Common.js and MediaWiki:Common.css

To support splitting Vector into 2 skins with minimum disruption to users using Vector legacy or modern version (the default on some wikis such as French Wikipedia) and expecting their user scripts/styles to apply (e.g. User:Jdlrobson/vector.css) we will need a similar hook for user scripts styles.

Acceptance criteria

  • If I use Legacy Vector, User:jdlrobson/vector.js, User:jdlrobson/vector.css, User:jdlrobson/vector19.js and User:jdlrobson/vector19.css will apply.
  • If I use Modern Vector, User:jdlrobson/vector.js, User:jdlrobson/vector.css, User:jdlrobson/vector22.js and User:jdlrobson/vector22.css will apply.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson renamed this task from Allow skins to change the pages used in user.js to Allow skins to change the pages used in user.js/css via hook.Sep 15 2021, 5:04 PM

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

[mediawiki/core@master] Allow hook modification of user styles/scripts

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

From the Gerrit patch:

I think we need to explore different solutions that are more sustainable and less disruptive and damaging to the ecosystem and our reputation in the short term. I've let a fair number of things slide and slip in to see how it plays out. I'm drawing a line here, and will inject myself now to try and get a more holistic understanding of what the plan is so that I can support you better aligned with the intended outcome, as so far I'm only guessing which isn't good for either of us.

My understanding from @ovasileva is that it's a hard requirement that users' Vector scripts, styles and gadgets continue to work on legacy Vector and are inherited by the new Vector to minimize disruption on end-users. To break these would cause lots of disruption to users and damage the brand of the desktop improvements project which has promised to minimize disruption and work on their side.

I'm not sure what to do with this feedback right now without getting more understanding on what is meant by "more sustainable and less disruptive and damaging to the ecosystem and our reputation".

We could create a Vector-specific module that extends ResourceLoaderUserModule::class but that seems worse than I what I suggested here. We could also do a bulk copy across all wikis but we're talking thousands of pages so that doesn't seem very sensible.

Copying @SCherukuwada given this impacts a technical goal of the team.

From the Gerrit patch:

I think we need to explore different solutions that are more sustainable and less disruptive and damaging to the ecosystem and our reputation in the short term. I've let a fair number of things slide and slip in to see how it plays out. I'm drawing a line here, and will inject myself now to try and get a more holistic understanding of what the plan is so that I can support you better aligned with the intended outcome, as so far I'm only guessing which isn't good for either of us.

My understanding from @ovasileva is that it's a hard requirement that users' Vector scripts, styles and gadgets continue to work on legacy Vector and are inherited by the new Vector to minimize disruption on end-users. To break these would cause lots of disruption to users and damage the brand of the desktop improvements project which has promised to minimize disruption and work on their side.

Confirming that this is a hard requirement from our side.

@ovasileva @SCherukuwada given the performance team is not in favor of a generic solution, one thing we could do is have the web team maintain a solution inside the Vector skin (proof of concept @ https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/713001 ). This would remove the blocker on the performance team.

That way, we can continue to load user styles/scripts for Vector and meet the product requirement. I am happy with the team owning the associated risk and technical debt with such a solution if we take this path and it would also allow us to remove support in the future via a User-notice.

If we take that path we can decline this task.

Change 726725 abandoned by Jdlrobson:

[mediawiki/core@master] Allow hook modification of user styles/scripts

Reason:

Per T291099#7460138 we'll do a Vector-only solution for now.

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

Given this is not wanted by performance team, declining.

We've hit a few issues with the user version, particularly in GlobalPreferences recently, so for this reason I'll suggest we push ahead with the technical goal T291098 ( with a Vector specific ResourceLoader module for handling the loading of existing Vector styles/scripts (T291099#7460138.). In future, we can work towards removing that if it becomes a burden.