Page does not always scroll to the top when DOM loads too fast
terracatta opened this issue · 0 comments
terracatta commented
I believe there is a race condition in Turbolinks where it attempts to change the scroll position to the top of the page before the DOM has been fully replaced, and as a result, the page is not scrolled to the top successfully.
Steps to reproduce.
- Start on page A (which should have a lot of content) and scroll to the bottom
- Click a link on page A that goes to page B (which should also have a lot of content that requires a scroll bar)
- You will be on the top of page B (as expected) now press back
- You will be in your former position on page A (as expected) now re-click the link to page B
Expected Result: page B loads and my scroll position is at the top of page B just like before
Actual Result: page B loads but my scroll position remains unchanged from page A
Again, I believe this is a race condition, if you add a simple <100ms timeout to this call then the problem is completely mitigated.