diff --git a/utils/docs/template/static/scripts/page.js b/utils/docs/template/static/scripts/page.js index b828f04ccf682e..ff4eb704d8ac03 100644 --- a/utils/docs/template/static/scripts/page.js +++ b/utils/docs/template/static/scripts/page.js @@ -32,7 +32,26 @@ if ( typeof hljs !== 'undefined' ) { const element = document.getElementById( hash ); - if ( element ) element.scrollIntoView(); + if ( element ) { + + // Safari needs a small delay for iframe scrolling + const isSafari = /^((?!chrome|android).)*safari/i.test( navigator.userAgent ); + + if ( isSafari ) { + + setTimeout( function () { + + element.scrollIntoView(); + + }, 250 ); + + } else { + + element.scrollIntoView(); + + } + + } }