Skip to content

Conversation

@aidanfnv
Copy link
Contributor

@aidanfnv aidanfnv commented Aug 8, 2025

Fixes #147

The scroll bar on ReadTheDocs is supposed to save the scroll bar position and restore it across pages, and it is using window.savedScrollPosition to do so.
While this solution was working in my testing before merging it in #132, it does not work in practice now for some reason.

This changes the save/restore logic to use sessionStorage instead, and also saves/restores the exact position of the page in the viewport, so even the case where the exact scrollbar position cannot be reused it still gets restored to the correct position.

The result can be previewed at https://shader-slanggithubio-aidanfnv-wip.readthedocs.io/en/fix-rtd-toc-scrolling-bug/, and I have confirmed that it is definitely working as expected there.

@aidanfnv aidanfnv requested review from csyonghe and jkwak-work August 8, 2025 01:12
@csyonghe csyonghe merged commit 14da5ba into shader-slang:main Aug 8, 2025
@aidanfnv aidanfnv deleted the fix/rtd-toc-scrolling-bug branch August 8, 2025 22:40
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.

TOC scrollbar position not saved on ReadTheDocs

2 participants