Page MenuHomePhabricator

Implement a way for wikis to provide js and css that is loaded in all skins (including mobile)
Closed, DuplicatePublic

Description

Having code duplicated in Common.css and Mobile.css, and possible App.css in the future doesn't look elegant.


Version: 1.24rc
Severity: enhancement

Details

Reference
bz65147

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:16 AM
bzimport set Reference to bz65147.
bzimport added a subscriber: Unknown Object (MLST).

I'm not sure I understand this bug report. For example, isn't "MediaWiki:Common.css" blank by default in MediaWiki core?

(In reply to Liangent from comment #0)

Having code duplicated in Common.css and Mobile.css, and possible App.css in
the future doesn't look elegant.

Do you mean something more like "Rename Common.css to Desktop.css, and have Common.css be loaded on all platforms (Desktop, Mobile and App)"?

(In reply to James Forrester from comment #2)

(In reply to Liangent from comment #0)

Having code duplicated in Common.css and Mobile.css, and possible App.css in
the future doesn't look elegant.

Do you mean something more like "Rename Common.css to Desktop.css, and have
Common.css be loaded on all platforms (Desktop, Mobile and App)"?

Kind of this, but do not use the existing Common.js which are already crowded of contents unsuitable in mobile.

(In reply to Liangent from comment #3)

(In reply to James Forrester from comment #2)

(In reply to Liangent from comment #0)

Having code duplicated in Common.css and Mobile.css, and possible App.css in
the future doesn't look elegant.

Do you mean something more like "Rename Common.css to Desktop.css, and have
Common.css be loaded on all platforms (Desktop, Mobile and App)"?

Kind of this, but do not use the existing Common.js which are already
crowded of contents unsuitable in mobile.

We can just move them; a bot move isn't that hard…

Just to note, there won't be an App.css. Mobile.css would load on both mobile web (and eventually) the apps.

(In reply to Yuvi Panda from comment #5)

Just to note, there won't be an App.css. Mobile.css would load on both
mobile web (and eventually) the apps.

Will apps support Mobile.js then?

and by the way I filed bug 65037 a while ago.

The bug as filed is a case of "works for me".

We have a global js/css, it's MediaWiki:Common.js and MediaWiki:Common.css.

The MobileFrontend extension is violating documentation and expectation by not loading it, that's a bug on their end.

Their decision to not load it is understandable however. Due to how these are used on specific wikis (e.g. Wikimedia's).

It's not entirely the fault of these scripts though. Mobile browsers weren't always officially supported by MediaWiki. Reaching out to the community and requesting they migrate things accordingly should be a reasonable path from here on out. If any exceptional problems or struggles come up, they should be able to get help from Wikimedia's mobile team to find a solution.

As for introducing a Desktop.css/js, I don't think that makes sense. We already have skin-specific site modules (Vector.js/css, Monobook.js/css, Mobile.js/css).

If code is common between both vector and monobook, it should probably be either duplicated in both, or improved to be generic enough and work on mobile as well. Mobile doesn't deserve that kind of special treatment imho, that encourages bad practices.

A good example is the accessibility and mobile compatibility of the Vector dropdown. It used to only work on hover. For many reasons (including mobile, but that doesn't even matter to me in this context), it was improved to also work on focus and click. This made it much more accessible and usable, and also made it work on mobile.

It is imho not worth it to duplicate that logic so that the 2 lines of code binding the "hover" handler aren't loaded on mobile. The module binds on all three (hover, click, focus) and that seems like a good pattern to follow. Being purist about every line of code in bandwidth isn't useful imho as there's much bigger fish to catch (both in that area and others).

Will it be possible to just do a big @import of Common.css in Mobile.css? It would be great if someone could test that out.