From 2c9264e412458c0887e17ebef7bf325b394edca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 4 Jun 2024 00:54:35 +0200 Subject: [PATCH] Remove jquery.makeCollapsible workarounds for mobile The module is now loaded normally by the Minerva skin (T111565). Bug: T323639 Change-Id: I9121410c20fffd651c81c26b84b861ec9300881f --- includes/Hooks/PageHooks.php | 7 ------- modules/LedeSectionDialog.js | 18 ++++-------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/includes/Hooks/PageHooks.php b/includes/Hooks/PageHooks.php index 59c991155..8f393f153 100644 --- a/includes/Hooks/PageHooks.php +++ b/includes/Hooks/PageHooks.php @@ -205,13 +205,6 @@ class PageHooks implements ] ) ) ) ); - - // Preload jquery.makeCollapsible for LedeSectionDialog. - // Using the same approach as in Skin::getDefaultModules in MediaWiki core. - if ( str_contains( $output->getHTML(), 'mw-collapsible' ) ) { - $output->addModules( 'jquery.makeCollapsible' ); - $output->addModuleStyles( 'jquery.makeCollapsible.styles' ); - } } } diff --git a/modules/LedeSectionDialog.js b/modules/LedeSectionDialog.js index 185c45023..0e661a8b1 100644 --- a/modules/LedeSectionDialog.js +++ b/modules/LedeSectionDialog.js @@ -36,20 +36,10 @@ LedeSectionDialog.prototype.getSetupProcess = function ( data ) { return LedeSectionDialog.super.prototype.getSetupProcess.call( this, data ) .next( () => { this.contentLayout.$element.empty().append( data.$content ); - - // Enable collapsible content (T323639), which is normally not handled on mobile (T111565). - // It's safe to do this twice if that changes (makeCollapsible() checks if each element was - // already handled). Using the same approach as in 'mediawiki.page.ready' in MediaWiki core. - const $collapsible = this.contentLayout.$element.find( '.mw-collapsible' ); - if ( $collapsible.length ) { - // This module is also preloaded in PageHooks to avoid visual jumps when things collapse. - mw.loader.using( 'jquery.makeCollapsible' ).then( () => { - $collapsible.makeCollapsible(); - $collapsible.on( 'afterExpand.mw-collapsible afterCollapse.mw-collapsible', () => { - this.updateSize(); - } ); - } ); - } + // Resize dialog if collapsible banners are toggled, see T323639 for context + this.contentLayout.$element.on( 'afterExpand.mw-collapsible afterCollapse.mw-collapsible', () => { + this.updateSize(); + } ); } ); };