-
Notifications
You must be signed in to change notification settings - Fork 436
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
Don't scroll to top of page on reload #571
Conversation
Potential solution for hotwired#387
@seanpdoyle 👋 could I bug you to give me some guidance on next steps here? |
Thank you for taking this on @srt32!
They aren't perfect, but there is a scrollToSelector and isScrolledToSelector methods available to the test suite. When interacting with them, make sure that the content being scrolled to or away from is far enough above or below the fold for the headless browsing session to change the scroll depth, otherwise the delta in scroll It isn't exactly the same, but https://github.com/hotwired/turbo/pull/476/files#diff-b7c9a06f6b41512fee24c53728cacc1b98c47e90ac291d047e576a686ee86c60 attempts to add coverage for a scroll-related issue. |
Thank you! I've started in on a spec but I'm struggling to reproduce a test where I can assert the scroll position prior to the page transitioning to the new URL. Do you have a recommendation on somehow pausing the transition at the right time? I've got something like this:
|
@manuelpuyol and I got a spec added that went red, green. It gets creative with localStorage and we saw it is a bit flaky with chrome (ie - it passes when it should not have). If we remove |
👋 I wonder if y'all could advise on next best steps here. Thanks! |
Great work on this! |
This PR fixes up lint violations after merging hotwired#571
Since [hotwired#571][] has shipped after this work was initially proposed, the implementation changes aren't necessary for the tests to pass. This change reverts the changes but retains the more thorough test coverage. [hotwired#571]: hotwired#571
Potential solution for #387
This change updates how we handle scrolling when the page gets reloaded due to a
reload
directive.I'm not sure if this is the proper way to gate the behavior but I was able to confirm the fix manual using the fixtures html files.
I'd also love to hear if there is a good way write a test for this fix.
Before:
Screen.Recording.2022-04-18.at.11.11.06.AM.mov
After:
Screen.Recording.2022-04-18.at.11.09.44.AM.mov