소스 검색

Prevent layout thrashing by status text

Jeroen Hermans 4 년 전
부모
커밋
aaa7c02b5c
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      js/reveal.js

+ 5 - 1
js/reveal.js

@@ -1335,7 +1335,11 @@ export default function( revealElement, options ) {
 		}
 		}
 
 
 		// Announce the current slide contents to screen readers
 		// 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();
 		progress.update();
 		controls.update();
 		controls.update();