Parcourir la source

Docs: Fix white flash on iframe load for Safari (#29419)

* Docs: Fix white flash on iframe load for Safari

* Fix white page for root level /docs page (when no page is selected)

* Update index.html

Fix code style.

* Remove unnecessary error event listener

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
Jeremy Parmenter il y a 6 jours
Parent
commit
3fa40fec35
1 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. 8 2
      docs/index.html

+ 8 - 2
docs/index.html

@@ -529,17 +529,23 @@
 			const oldIframe = iframe;
 			iframe = oldIframe.cloneNode();
 
+			iframe.style.display = 'none';
+
 			if ( hash && titles[ splitHash[ 0 ] ] ) {
 
+				iframe.onload = function () {
+
+					iframe.style.display = 'unset';
+
+				};
+
 				iframe.src = splitHash[ 0 ] + '.html' + splitHash[ 1 ];
 				subtitle = titles[ splitHash[ 0 ] ] + splitHash[ 1 ] + ' – ';
-				iframe.style.display = 'unset';
 
 			} else {
 
 				iframe.src = '';
 				subtitle = '';
-				iframe.style.display = 'none';
 
 			}