Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion utils/docs/template/static/scripts/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

}, 100 );
Copy link
Collaborator

@Mugen87 Mugen87 Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested a bit more and it seems increasing the timeout from 100 to 200 solves the issue on my macMini.

Given that TSL.html is by far the largest document, the Safari probably needs more time to make the page ready.

Copy link
Collaborator

@Mugen87 Mugen87 Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we find no other solution, I would like to file a bug at the WebKit bug reporter. I've already searched but found no open bug about scrollIntoView() issues in context of iFrames.

https://bugs.webkit.org/buglist.cgi?bug_status=__open__&content=scrollIntoView&no_redirect=1&order=Importance&product=WebKit&query_format=specific

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrdoob I've increased the timeout from 100ms to 250 ms which worked on my macMini and an iPad.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing the time out does not work for me. I tried searching for "translate".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With what devices have you tested?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M1 iMac MacOS Tahoe 26.1 Safari 26.1.

To be clear, when searching for "translate", sometimes it works, and in other cases the iframe is blank, and scrolling is necessary to locate the proper position in the file.

Copy link
Collaborator

@Mugen87 Mugen87 Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me on all my devices. But it starts failing if I decrease the timeout value.

Just for fun I have removed the element.scrollIntoView() call. In Chrome and Firefox, the navigation is still correct but Safari fails. The page in the iFrame is blank and the content only appears if I scroll up. Trying to select text also works.

So it seems the issue is not related to scrollIntoView(). The iFrame page isn't correctly loaded in the first place and that's maybe why scrollIntoView() fails as well.


} else {

element.scrollIntoView();

}

}

}

Expand Down