From aaa7c02b5c7cc6a1697d90c786268cb72d0649be Mon Sep 17 00:00:00 2001 From: Jeroen Hermans Date: Sun, 15 Nov 2020 21:54:05 +0100 Subject: [PATCH] Prevent layout thrashing by status text --- js/reveal.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index 727cc8e..b3f81a1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1335,7 +1335,11 @@ export default function( revealElement, options ) { } // Announce the current slide contents to screen readers - announceStatus( getStatusText( currentSlide ) ); + // Use animation frame to prevent getComputedStyle in getStatusText + // from triggering layout mid-frame + requestAnimationFrame( function() { + announceStatus( getStatusText( currentSlide ) ); + }); progress.update(); controls.update();