From 10d3c17f185441c5424dfbee4318648313a50417 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Sat, 19 Oct 2024 00:13:13 -0400 Subject: [PATCH] =?UTF-8?q?perf(core):=20=E2=9A=A1=EF=B8=8F=20disable=20al?= =?UTF-8?q?l=20CSS=20transition=20during=20window=20resize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/skins.citizen.scripts/skin.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/skins.citizen.scripts/skin.js b/resources/skins.citizen.scripts/skin.js index 8e3f6d87..af5a53c6 100644 --- a/resources/skins.citizen.scripts/skin.js +++ b/resources/skins.citizen.scripts/skin.js @@ -7,6 +7,16 @@ */ function enableCssAnimations( document ) { document.documentElement.classList.add( 'citizen-animations-ready' ); + + // Disable all CSS transition during resize + const onResize = () => { + document.documentElement.classList.remove( 'citizen-animations-ready' ); + }; + const onResizeEnd = mw.util.debounce( () => { + document.documentElement.classList.add( 'citizen-animations-ready' ); + }, 250 ); + window.addEventListener( 'resize', onResize ); + window.addEventListener( 'resize', onResizeEnd ); } /**