Revert "Add exclusion behaviour for "width" option in Appearance menu"

This reverts commit ff5a61e9c6.

Reason for revert: The behaviour introduced in this patch needs some more consideration.

Bug: T364015
Change-Id: Ieab4ca4084df4f1b5c942fe81c7fb99b058e0623
This commit is contained in:
Jdrewniak 2024-05-22 16:58:32 +00:00
parent f075bb0823
commit 607e6b39c5
7 changed files with 24 additions and 23 deletions

View file

@ -209,14 +209,6 @@ class FeatureManager {
$prefix .= 'skin-theme-';
break;
case CONSTANTS::FEATURE_LIMITED_WIDTH:
if ( ConfigHelper::shouldDisable( $config->get( 'VectorMaxWidthOptions' ), $request, $title ) ) {
return 'vector-feature-limited-width-clientpref--excluded';
}
$suffixEnabled = 'clientpref-1';
$suffixDisabled = 'clientpref-0';
break;
case CONSTANTS::FEATURE_TOC_PINNED:
case CONSTANTS::FEATURE_APPEARANCE_PINNED:
$suffixEnabled = 'clientpref-1';

View file

@ -18,3 +18,17 @@
.client-nojs .vector-appearance-landmark {
display: none;
}
// By default, limited width client pref should be hidden unless the breakpoint below is reached.
#skin-client-prefs-vector-feature-limited-width {
display: none;
}
// Note on certain pages the control will have no effect e.g. Special:RecentChanges
// Defining this at 1400px is a product decision so do not change it
// (more context at https://phabricator.wikimedia.org/T326887#8540889)
@media ( min-width: 1400px ) {
#skin-client-prefs-vector-feature-limited-width {
display: block;
}
}

View file

@ -31,6 +31,12 @@
display: none;
}
// On pages that have $wgVectorMaxWidthOptions['exclude'] true,
// the toggle should be hidden. This rule overrides the media query below.
html.vector-feature-limited-width-clientpref--excluded .vector-limited-width-toggle.cdx-button {
display: none;
}
// Note on certain pages the control will have no effect e.g. Special:RecentChanges
// Defining this at 1400px is a product decision so do not change it
// (more context at https://phabricator.wikimedia.org/T326887#8540889)

View file

@ -127,7 +127,6 @@
column-gap: @grid-column-gap;
}
.vector-feature-limited-width-clientpref--excluded .mw-body,
.vector-feature-limited-width-clientpref-0 .mw-body,
.vector-feature-limited-width-content-disabled .mw-body {
grid-template-columns: ~'minmax(0, 1fr) min-content';

View file

@ -158,9 +158,6 @@ body {
.mixin-vector-page-container-sizing();
}
.vector-feature-limited-width-clientpref--excluded .mw-page-container,
.vector-feature-limited-width-clientpref--excluded .vector-sticky-header,
.vector-feature-limited-width-clientpref--excluded .mw-header,
.vector-feature-limited-width-clientpref-0 .mw-page-container,
.vector-feature-limited-width-clientpref-0 .vector-sticky-header,
.vector-feature-limited-width-clientpref-0 .mw-header {

View file

@ -388,7 +388,6 @@
"vector-feature-limited-width-name",
"vector-feature-limited-width-0-label",
"vector-feature-limited-width-1-label",
"vector-feature-limited-width-exclusion-notice",
"vector-feature-custom-font-size-name",
"vector-feature-custom-font-size-0-label",
"vector-feature-custom-font-size-1-label",

View file

@ -91,32 +91,26 @@ class FeatureManagerTest extends \MediaWikiIntegrationTestCase {
}
/** ensure the class is present when disabled and absent when not */
public static function provideGetFeatureBodyClassExcluded() {
public static function provideGetFeatureBodyClassNightModeDisabled() {
return [
[ true ], [ false ]
];
}
/**
* @dataProvider provideGetFeatureBodyClassExcluded
* @dataProvider provideGetFeatureBodyClassNightModeDisabled
* @covers ::getFeatureBodyClass pref night mode specifics - disabled pages
*/
public function testGetFeatureBodyClassExcluded( $disabled ) {
public function testGetFeatureBodyClassNightModeDisabled( $disabled ) {
$featureManager = $this->newFeatureManager();
$featureManager->registerFeature( CONSTANTS::PREF_NIGHT_MODE, [] );
$featureManager->registerFeature( CONSTANTS::FEATURE_LIMITED_WIDTH, [] );
$context = RequestContext::getMain();
$context->setTitle( Title::makeTitle( NS_MAIN, 'Main Page' ) );
$this->overrideConfigValues( [ 'VectorNightModeOptions' => [ 'exclude' => [ 'mainpage' => $disabled ] ] ] );
$this->overrideConfigValues( [ 'VectorMaxWidthOptions' => [ 'exclude' => [ 'mainpage' => $disabled ] ] ] );
$bodyClasses = $featureManager->getFeatureBodyClass();
$this->assertEquals(
in_array( 'skin-theme-clientpref--excluded', $bodyClasses ) &&
in_array( 'vector-feature-limited-width-clientpref--excluded', $bodyClasses ),
in_array( 'skin-theme-clientpref--excluded', $featureManager->getFeatureBodyClass() ),
$disabled
);
}