Merge "Remove jquery.makeCollapsible workarounds for mobile"

This commit is contained in:
jenkins-bot 2024-06-10 19:29:49 +00:00 committed by Gerrit Code Review
commit a3adda8ed7
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();
} );
} );
};