Remove jquery.makeCollapsible workarounds for mobile

The module is now loaded normally by the Minerva skin (T111565).

Bug: T323639
Change-Id: I9121410c20fffd651c81c26b84b861ec9300881f
This commit is contained in:
Bartosz Dziewoński 2024-06-04 00:54:35 +02:00
parent bf09928773
commit 2c9264e412
2 changed files with 4 additions and 21 deletions

View file

@ -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' );
}
}
}

View file

@ -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();
} );
} );
};