From c8dd4e9ed176925a4b4ce275d33412a6b1d6ea09 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 31 Aug 2021 12:22:25 -0700 Subject: [PATCH] Remove disable dropdown behavior Now that we bind the ULS dialog to the checkbox element, (see c08ae11) the default behaviour of the checkbos is prevented, so it is impossible for the dropdown to ever be shown when ULS is enabled and clicked so this code no longer serves any purpose. Depends-On: I97a69c30b27cb1ded06451389e086229561c3589 Change-Id: Ic9d03dea12ee8bb2d7430eccd70e4343e3805d36 --- resources/skins.vector.js/languageButton.js | 31 ------------------- .../components/LanguageButton.less | 11 ------- 2 files changed, 42 deletions(-) diff --git a/resources/skins.vector.js/languageButton.js b/resources/skins.vector.js/languageButton.js index 9c930d8af..351c0cde2 100644 --- a/resources/skins.vector.js/languageButton.js +++ b/resources/skins.vector.js/languageButton.js @@ -19,40 +19,9 @@ function addInterwikiLinkToSidebar() { } } -/** - * Disable dropdown behaviour for non-JS users. - * - * @param {HTMLElement|null} pLangBtn - * @return {void} - */ -function disableDropdownBehavior( pLangBtn ) { - if ( !pLangBtn ) { - return; - } - pLangBtn.classList.add( 'vector-menu-hide-dropdown' ); -} - -/** - * Checks whether ULS is enabled and if so disables the default - * drop down behavior of the button. - */ -function disableLanguageDropdown() { - var ulsModuleStatus = mw.loader.getState( 'ext.uls.interface' ); - - // If module status is defined and not registered we can assume it is in the process of loading - if ( ulsModuleStatus && ulsModuleStatus !== 'registered' ) { - // HACK: Ideally knowledge of internal ULS configuration would not be necessary - // In future this should be wired up to an `mw.hook` event. - if ( mw.config.get( 'wgULSisCompactLinksEnabled' ) ) { - disableDropdownBehavior( document.getElementById( 'p-lang-btn' ) ); - } - } -} - /** * Initialize the language button. */ module.exports = function () { - disableLanguageDropdown(); addInterwikiLinkToSidebar(); }; diff --git a/resources/skins.vector.styles/components/LanguageButton.less b/resources/skins.vector.styles/components/LanguageButton.less index 1dd86a53e..7ce09def6 100644 --- a/resources/skins.vector.styles/components/LanguageButton.less +++ b/resources/skins.vector.styles/components/LanguageButton.less @@ -65,17 +65,6 @@ } } -// mw-body-header class can be removed when language button is the default. -// e.g. upon removal of SkinVector::isLanguagesInHeader -.client-js #p-lang-btn { - // When the ext.uls.interface module is loaded, we hide the fallback menu and checkbox. - &.vector-menu-hide-dropdown { - .vector-menu-content { - display: none; - } - } -} - // Hides language button with CSS, ensures language button is in DOM for temporary JS hack for interwiki links // Temporary solution to T287206, can be removed when ULS dialog includes interwiki links #p-lang-btn.mw-portlet-empty {