Page MenuHomePhabricator

MonoBook users should check their preferences to avoid disruption
Open, Needs TriagePublic

Description

Who: MonoBook has a preference that displays viewport adapting behaviour on mobile devices. If you use this, at a future date, this will temporarily stop working without any action.

In T285402, the MonoBook preference was generalized to become a preference that applies to all skins and in several weeks time it will apply to MonoBook replacing the existing preference.

How: TO see if you are impacted visit [[ Special:Preferences ]] and check if the "Enable responsive MonoBook design" is unticked like so:

Screen Shot 2021-07-01 at 3.58.25 PM.png (126×638 px, 8 KB)

If it is, you will need to untick the box "Enable responsive mode":

Screen Shot 2021-07-01 at 4.02.01 PM.png (148×1 px, 28 KB)

Note project admins can automate this migration with the following temporary code inside MediaWiki:MonoBook.js:

/**
 * Monobook preference migration code.
 */
function updateCorePreferenceIfMonobookSet() {
    var api = new mw.Api();
    var val = mw.user.options.get( 'skin-responsive' );
    var skinResponsiveNotSet = val !== 0;
    var api = new mw.Api();
    // No viewport detected in HTML and new MediaWiki core preference is not set.
    if ( !$( 'meta[name=viewport]' ).length && skinResponsiveNotSet ) {
        api.saveOption( 'skin-responsive', 0 );
    }
}
$( updateCorePreferenceIfMonobookSet );

Note about db migration

The number of users impacted is quite low, but we could run a database migration if we prefer, migrating monobook-responsive preference to skin-responsive.

Event Timeline

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

[mediawiki/skins/MonoBook@master] Drop MonoBook responsive preference

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

The description needs correction, see my comment at T285402#7195506

The action is the important thing here. Sooner the action happens the sooner we can remove it.

I suggest this code:

/**
 * Monobook preference migration code.
 */
function updatePreferencesIfResponsiveMonobookDesignDisabled() {
	if ( $( 'meta[name=viewport]' ).length ) { return }

	mw.loader.using( [ 'mediawiki.api', 'user.options' ] ).done( function () {
		var skinResponsiveEnabled = mw.user.options.get( 'skin-responsive' ) !== 0;
		// No viewport detected in HTML and new MediaWiki core preference is checked.
		if ( skinResponsiveEnabled ) {
			new mw.Api().saveOption( 'skin-responsive', 0 );
		}
	} );
}
$( updatePreferencesIfResponsiveMonobookDesignDisabled );

However, this still means that switching to Monobook skin even for a split second will disable responsive mode for all skins without the user noticing. It isn't ideal in the long term.