Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug with [scroll-region] elements not restoring correct scroll positions in react adapter #1796

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dsazup
Copy link

@dsazup dsazup commented Feb 12, 2024

Hi, I'm using react and I run into a bug where I have a [scroll-region] element and after navigating back, the scroll position is not restored, even though the page has saved the positions correctly.

This happens because in the restoreScrollPositions method this.scrollRegions() returns an empty array. It thinks that there aren't any [scroll-region] elements, because the document body hasn't been updated yet. Even though there actually is an element. Simply wrapping the whole thing in setTimeout fixes it and positions are restored correctly.

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.

None yet

1 participant