Merge "Follow-up Ie0a938249: Add comment explaining why resize event is needed"

This commit is contained in:
jenkins-bot 2024-09-06 19:54:36 +00:00 committed by Gerrit Code Review
commit 1c3ee74a7a

View file

@ -68,6 +68,8 @@ function toggleDocClassAndSave( featureName, value, config, userPreferences ) {
document.documentElement.classList.remove( `${ featureName }-clientpref-${ possibleValue }` );
} );
document.documentElement.classList.add( `${ featureName }-clientpref-${ value }` );
// Client preferences often change the layout of the page significantly, so emit
// a window resize event for other apps that need to update (T374092).
window.dispatchEvent( new Event( 'resize' ) );
// Ideally this should be taken care of via a single core helper function.
mw.util.debounce( () => {