diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 166d1d01..ed874515 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -87,18 +87,6 @@ class SkinVector extends SkinMustache { $options['styles'] = [ 'skins.vector.styles.legacy' ]; $options['template'] = 'skin-legacy'; } else { - // For historic reasons, the viewport is added when Vector is loaded on the mobile - // domain. This is only possible for 3rd parties or by useskin parameter as there is - // no preference for changing mobile skin. - $responsive = $this->getConfig()->get( 'VectorResponsive' ); - if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) { - $mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' ); - if ( $mobFrontContext->shouldDisplayMobileView() ) { - $responsive = true; - } - } - $options['responsive'] = $responsive; - if ( $this->shouldConsolidateUserLinks() ) { $options['link'] = [ 'text-wrapper' => [ 'tag' => 'span' ] ]; } @@ -435,6 +423,24 @@ class SkinVector extends SkinMustache { return Constants::SEARCH_BOX_INPUT_LOCATION_MOVED; } + /** + * @inheritDoc + */ + public function isResponsive() { + // Check it's enabled by user preference and configuration + $responsive = parent::isResponsive() && $this->getConfig()->get( 'VectorResponsive' ); + // For historic reasons, the viewport is added when Vector is loaded on the mobile + // domain. This is only possible for 3rd parties or by useskin parameter as there is + // no preference for changing mobile skin. Only need to check if $responsive is falsey. + if ( !$responsive && ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) { + $mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' ); + if ( $mobFrontContext->shouldDisplayMobileView() ) { + return true; + } + } + return $responsive; + } + /** * Determines whether or not the search input should expand when focused * before WVUI search is loaded. In WVUI, the search input expands to diff --git a/skin.json b/skin.json index d097b164..7349c916 100644 --- a/skin.json +++ b/skin.json @@ -24,6 +24,7 @@ "scripts": [ "skins.vector.js" ], + "responsive": true, "styles": [ "mediawiki.ui.button", "skins.vector.styles",