Page MenuHomePhabricator

Gadgets with skin-specific behaviour should update their code to check for Vector 2022
Closed, ResolvedPublic

Description

NOTE: The only change needed here is changing checks to mw.config.get('skin').
NOTE: Both Vector skins by design load User:<username>/vector.(js|css) and MediaWiki:Vector.(css|js) to minimize disruption to editors and projects which have defaulted to the new Vector skin. There is no need to copy across user styles and scripts.

Context: On Thursday 3rd February an unplanned change was made to urgently fix a bug with the "live edit preview". This change may have disabled certain gadgets, or made gadgets work slightly differently in the Vector 2022 skin.

How to fix: Every gadget run in Vector should also work in Vector 2022, so all you need to do is also check the vector-2022 skin key if you are already checking the vector key.

Search

Your gadget may need fixing if it contains the code "vector" or uses mw.config.get('skin') appearing in this search: https://global-search.toolforge.org/?q=%5B%22%27%5Dvector%5B%27%22%5D&regex=1&namespaces=2%2C8&title=.*%5C.js

Code snippet

This:

if ( mw.config.get( "skin" ) === "vector"  ) {}

can be replaced with:

var isVectorSkin = mw.config.get( "skin" ) === "vector"  || mw.config.get( "skin" ) === "vector-2022" 
if ( isVectorSkin  ) {}

You may also need to update [[MediaWiki:Gadgets-definition]] to enable any vector gadgets on vector-2022

Example of a fix

Event Timeline

CSS is also affected, even outside of the user and MediaWiki namespace (e.g. in TemplateStyles stylesheets). Global search: https://global-search.toolforge.org/?q=skin-vector&regex=1&title=.*\.(css|js)

CSS is also affected, even outside of the user and MediaWiki namespace (e.g. in TemplateStyles stylesheets). Global search: https://global-search.toolforge.org/?q=skin-vector&regex=1&title=.*\.(css|js)

CSS should not be impacted. Vector and Vector 2022 both add the skin-vector class to the page so no change necessary.

Is this a one-time only change? Or should we expect for this trend to continue in the future? I'm wondering how to modify gadgets (add a new string to if/switch or change to prefix-check).

Note that aside from gadget changes there are some help pages mentioning vector.js and vector.css of users. So when users switch they need to copy their scripts and css and loosing history.

And probably some more things are affected by this. For example on en.wiki there is a separate header for skin-files. For example for User:Nux/vector.js the header says:

The accompanying .css page for this skin is at User:Nux/vector.css.

Already reported on Village Pump. Just posting as an example of less obvious dependencies on skin names.

All that is not a big problem if this a one time thing, but if there would one skin each year than that might be a problem.

@Nux this is a one-time change. No Vector skins are planned for the foreseeable future.

Note that aside from gadget changes there are some help pages mentioning vector.js and vector.css of users. So when users switch they need to copy their scripts and css and loosing history.

No changes necessary here. Both Vector skins will load User:<username>/vector.(css|js).
Please be careful with messages and certainly don't ask users to copy Vector.(css|js) to Vector-22.(css|js), as doing so will break their gadgets.

Dual loading of the pages is not going to change any time soon. It's needed for now, as many wikis are using the new Vector skin as the default experience and we wanted to minimize disruption to their workflows.

No changes necessary here. Both Vector skins will load User:<username>/vector.(css|js).

In that case preferences page is misleading. I have a link to [[User:Nux/vector-2022.js]].

CSS is also affected, even outside of the user and MediaWiki namespace (e.g. in TemplateStyles stylesheets). Global search: https://global-search.toolforge.org/?q=skin-vector&regex=1&title=.*\.(css|js)

CSS should not be impacted. Vector and Vector 2022 both add the skin-vector class to the page so no change necessary.

Oh, I see. When I saw that new Vector adds the vector-2022 class, I thought that CSS is also broken; I didn’t think of the possibility of adding both classes. Thanks for clarifying!

In that case preferences page is misleading. I have a link to [[User:Nux/vector-2022.js]].

Both User:Nux/vector-2022.js and User:Nux/vector.js will be loaded. Yes the preferences is a little confusing, but I'm not 100% sure how to fix that or if it's worth fixing at the current point in time since this is temporary behaviour.

In that case preferences page is misleading. I have a link to [[User:Nux/vector-2022.js]].

Both User:Nux/vector-2022.js and User:Nux/vector.js will be loaded. Yes the preferences is a little confusing, but I'm not 100% sure how to fix that or if it's worth fixing at the current point in time since this is temporary behaviour.

OK, that probably won't cause immediate problems...

But what do you mean by temporary? 😅... I mean, I thought vector-2022 is going to be a new skin which we should now support. By "we" I mean other UI admins, gadget devs and wiki community in general.

So what is the end game here? Old vector skin will be removed? Renamed? Or what? New skin will be renamed again to replace old vector?

In any case I do hope next skin introduction will be announced in Tech News before it actually happens 😉. I mean it actually wasn't as bad as I imagined, but would be great to have some time to prepare.

But what do you mean by temporary?

The loading of both pages is temporarly. The skins themselves are permenant. Please follow up on T301212 if you have any further questions about that.

In any case I do hope next skin introduction will be announced in Tech News before it actually happens 😉.

As I wrote in description, on Thursday 3rd February an unplanned change was made. There was originally no need to prepare, but mistakes happen.

Quiddity moved this task from Announce in next Tech/News to In current Tech/News draft on the User-notice board.

This has been announced. Does this task still need to remain open or has it served its purpose?

Jdlrobson claimed this task.