Skip to content

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Nov 19, 2025

Related issue: #32302

Description

Fixes an issue where clicking on navigation links in Safari would not scroll to the correct position within the documentation iframe.

The problem occurred because Safari needs additional time to complete iframe layout before scrollIntoView can accurately position the target element. This was only noticeable when navigating via clicks - direct page loads with hash fragments worked fine due to browser's native hash handling.

The fix adds Safari-specific detection and applies a 100ms delay before scrolling, giving Safari time to properly lay out the iframe content.

@mrdoob mrdoob added this to the r182 milestone Nov 19, 2025
@mrdoob
Copy link
Owner Author

mrdoob commented Nov 19, 2025

This solves https://threejs.org/docs/?q=setviewport#Renderer.setViewport (reported by @WestLangley)
But doesn't solve https://threejs.org/docs/#TSL.Break ...

Needs more work/investigation.


element.scrollIntoView();

}, 100 );
Copy link
Collaborator

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 HTML parser 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants