Page MenuHomePhabricator

Options to only use a specific layout/not go bigger - single-column with only dropdown menus, or one sidebar-only
Open, Needs TriagePublic

Description

The skin Timeless shows a left and a right sidebar in wide windows, but dropdown menus in narrow ones. Some users and site admins would prefer sticking to a specific layout regardless of size and only scaling down if needed:

  • Capping at single-column, where the menus are always dropdowns.
  • Only one sidebar, for consistency with other skins like MonoBook/Vector, and avoiding confusion with where the tools will appear when often jumping between different resolutions on either side of the cutoff

Do these as user options, where the site can specify the default.

Event Timeline

Maybe this is a good case for a custom setting at the users preferences?

Maybe this is a good case for a custom setting at the users preferences?

That's what I'm thinking. User setting or site setting or both. Generally on a huge screen there's a lot of unused space so we should be using that, but if people don't want that there's no good reason they shouldn't be able to turn it off and thus focus more on the content.

I think if you add an user setting for "Show always dropdowns". it should only change the behavior at huge screens if it is unset. Noone is happy if large sidebars are displayed at mobile view.

Yeah, option to just disable the sidebars and use the screen-small layout (the with dropdowns) for all aside from actual mobile. There's precedent.

Isarra renamed this task from Always show dropdown menus in the skin Timeless to Option to always show dropdown menus in the skin Timeless/no sidebars.Aug 17 2017, 6:57 PM
Isarra added subscribers: IKhitron, Amire80.
Isarra renamed this task from Option to always show dropdown menus in the skin Timeless/no sidebars to Options to only use a specific layout/not go bigger - single-column with only dropdown menus, or one sidebar-only.Jan 18 2019, 9:05 PM
Isarra updated the task description. (Show Details)

I would appreciate having a single-sidebar option.
I'm not sure if the skin developers will add that option, so here is temporary workaround to add to your wiki's Timeless.css.

@media (min-width: 1340px) {
  #mw-content-block {
    display: block;
  }
  #mw-content,
  #content-bottom-stuff {
  margin-left: 14em;
  }
  #mw-content-wrapper {
    float: right;
    margin-left: -14em;
    width: 100%;
  }
  #mw-related-navigation {
    width: 14em;
    padding: 0 1em 0 0;
  }
}

So we add some 'Desktop layout options':

  • Single column layout with dropdown navigation
  • Navigation in left-sidebar only
  • Navigation and page tools in left and right sidebars

Where if it doesn't fit each will still scale down to the narrower ones; what this allows is disabling scaling up, essentially. Moo.

Change 530202 had a related patch set uploaded (by Isarra; owner: Isarra):
[mediawiki/skins/Timeless@master] Add settings to use a particular layout even at higher resolutions (cap at single column or single-sidebar instead of the default three- column mode)

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

Change 530202 merged by jenkins-bot:
[mediawiki/skins/Timeless@master] Add settings to use a particular layout even at higher resolutions

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

Patch was reverted for reasons. Apparently mw has too many modules and that's bad for js.

Also possibly introduced FOUC issues due to how/when we're loading the different modules? Unclear.

A note in case it gets implemented again (which I would appreciate a lot!): since T246296 there’s a much more convenient way to show the preference only on Timeless. As far as I understand, instead of

	/**
	 * Add preference(s)
	 *
	 * @param User $user
	 * @param array &$preferences
	 */
	public static function onGetPreferences( User $user, array &$preferences ) {
		$context = RequestContext::getMain();
		$useskin = $context->getRequest()->getVal( 'useskin', false );
		$skin = $useskin ?: $user->getOption( 'skin' );

		$defaultLayout = $context->getConfig()->get( 'TimelessDefaultLayout' );

		if ( $skin == 'timeless' ) {
			$layouts = [
				'one-column',
				'two-column',
				'three-column'
			];
			$layoutOptions = [];
			foreach ( $layouts as $layoutOption ) {
				$layoutOptions[$context->msg( "timeless-pref-$layoutOption" )->escaped()] = $layoutOption;
			}

			$preferences['timeless-layout'] = [
				'type' => 'select',
				'options' => $layoutOptions,
				'default' => $user->getOption( 'timeless-layout', $defaultLayout ),
				'label-message' => 'timeless-layout-preference',
				'section' => 'rendering/skin'
			];
		}
	}

it can be written as

	/**
	 * Add preference(s)
	 *
	 * @param User $user
	 * @param array &$preferences
	 */
	public static function onGetPreferences( User $user, array &$preferences ) {
		$context = RequestContext::getMain();
		$defaultLayout = $context->getConfig()->get( 'TimelessDefaultLayout' );

		$layouts = [
			'one-column',
			'two-column',
			'three-column'
		];
		$layoutOptions = [];
		foreach ( $layouts as $layoutOption ) {
			$layoutOptions[$context->msg( "timeless-pref-$layoutOption" )->escaped()] = $layoutOption;
		}

		$preferences['timeless-layout'] = [
			'type' => 'select',
			'options' => $layoutOptions,
			'default' => $user->getOption( 'timeless-layout', $defaultLayout ),
			'label-message' => 'timeless-layout-preference',
			'section' => 'rendering/skin/skin-prefs',
			'hide-if' => [ '!==', 'wpskin', 'timeless' ],
		];
	}

and it will automatically appear as soon as Timeless is ticked (not only after saving the skin preference) and disappear as soon as another skin is selected. (Please note that I haven’t tested this code, so it may contain typos or may not work in this form, but at least you get the idea.)

Neat.

So basically we just need to sort out how to do this in a way that doesn't balloon the css or make it inordinately difficult to work with, was my understanding, but it sounds like we're still in a better place overall now than we were...