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

Page freeze in Safari when navigating using trackpad swipe #685

Closed
istvanvasil opened this issue Oct 4, 2018 · 3 comments
Closed

Page freeze in Safari when navigating using trackpad swipe #685

istvanvasil opened this issue Oct 4, 2018 · 3 comments

Comments

@istvanvasil
Copy link

istvanvasil commented Oct 4, 2018

A strange behaviour I have observed in Safari when navigating back to a view using swipe on the trackpad on my Macbook pro. The page freezes for a few seconds before I can interact with it again.

Observed similar behaviour on other choo sites too. Since I don't want to make my project public just yet I illustrate the behaviour with an example:

  1. Navigate to https://jon-kyle.com/.
  2. On the first page scroll down to the middle of the page with all the thumbnails (Select projects, randomized, for..etc.)
  3. Click on any of them then try to navigate back by using the "swipe left and right between pages" function on your trackpad.
  4. Freeze happens for a few seconds before you can do anything.

Here is a video showing the behaviour: choo freeze

My page structure is simple. It's a website for a photographer with a series of right and left floated thumbnails that take you to a project page. It happens with thumbnails lowest on the page only. Not with the ones on the top. Although they are identical in every sense. They take you to the same view and load same type of content.

Did anyone observe this behaviour before?

I hope you don't mind @jondashkyle that I used your site as an example. Maybe you have an idea about this?

Thank you!

@istvanvasil
Copy link
Author

istvanvasil commented Oct 6, 2018

Edit:

Setting scroll restoration to manual eliminates this bug.

if (typeof window !== 'undefined' && window.history.scrollRestoration) {
  window.history.scrollRestoration = 'manual'
}

Then manually handling page restoration.

Wondering if this is a known Safari issue or a Choo bug? @yoshuawuyts @tornqvist

@goto-bus-stop
Copy link
Member

FWIW I have heard of this problem before so you're not the only one, but I have no clue what causes it and whether choo is responsible, unfortunately :(

@istvanvasil
Copy link
Author

Thanks @goto-bus-stop
I managed to solve this for my project with the above described solution. Hope this can be helpful for others who land here.

Taking manual control over scroll restoration creates a 100% accurate popState navigation vs. the sometimes jumpy auto one. So, besides eliminating this issue, that's another upside of it.

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

No branches or pull requests

2 participants