-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Stutter scrolling on iOS Safari 17 #8625
Comments
If I may suggest try the fallback option in your ViewTransitions as the view transition api only works in chromium browsers currently, word is their team is still developing browser support |
That's what I did, but setting fallback to none also disables Astro's SPA behavior, which I think are two separated things in the same feature. I was relying on the astro:page-load event listener which as result doesn't fire on Safari with fallback none, so I had to do some extra work to make interactive components behave correctly in SPA and MPA modes. Ideally it should just work since that's what advertised... When enabled it does present a fade animation in Safari but I guess there's some unthrottled function running at 120hz and causing performance issues. |
the last few updates haven't addressed this issue. Theres something I can do to help? To quickly reproduce the issue all it takes is to start a Astro project with blog template, import the |
@evertjr you could try tweaking the value here: https://github.com/withastro/astro/blob/main/packages/astro/src/transitions/router.ts#L520-L521 The |
Also having this issue. Also perceptible by trying to over-scroll the container on desktop devices. Linke you mentioned @matthewp is no longer there, and there's no |
@fredericoo The number is here:
350
|
Glad I'm not seeing things. Thought it was just me. I've added the fallback to none and it's all good for me now. I did some general testing and found it's iOS Safari & iOS Chrome where I'm seeing issues. Firefox is smooth. Using iPhone 14 pro. Astro 4.3.1 |
@QasimArif Can you try adjusting the values in #8625 (comment) and see if that helps? |
* fix(#8625): smooth scrolling in SPA mode on iOS * perf(router): run cb every 200ms only when scolling * refactor(router): suggested changes and fixes Suggested changes: - change interval time from 200 to 50ms - initialize `last*` vars together with the call to `setInterval()` - clear interval when scroll positions stop changing, independent of history state Additional changes: - remove unused `throttle()` function - move guarded block to inside `onScrollEnd()` since using history navigation will trigger our "popstate" callback and fire additional "scroll" and "scrollend" events, causing redundant expensive calls to `replaceState()` * adds changeset --------- Co-authored-by: Martin Trapp <[email protected]>
* main: [ci] format fix(withastro#8625): smooth scrolling in SPA mode on iOS (withastro#10235) [ci] release (withastro#10292) [ci] format finalize WIP API (withastro#10280) [ci] format fix(markdoc & mdx): Proxy crimes (withastro#10278) [ci] release (withastro#10286) fix(audits): Don't warn about loading on data URIs (withastro#10275) fix(node): Safely create requests (withastro#10285) [ci] release (withastro#10265) [ci] format fix(assets): Solidify Node endpoint (withastro#10284)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Safari
Describe the Bug
I used the blog template to start with.
I'm using SPA mode by importing
<ViewTransitions />
component in the common<head>
It works fine in all browsers, except on iOS Safari on my iPhone 14 Pro Max, the scroll is extremely stuttery and it's likely using a lot of CPU as the phone gets warm. This doesn't happen in other SPAs using other frameworks.
Setting the fallback to none fixes the problem but disables the SPA behavior, the problem persists even with fallback swap.
Weirdly enough on my old iPad 9 it works fine, maybe it's something related to the ProMotion display? I'm not sure how Astro implementation works but this demo https://live-transitions.pages.dev/ doesn't cause any issues.
What's the expected result?
The scroll should be smooth and a simple static webpage should not cause high cpu usage.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-rywjxp?file=src%2Fcomponents%2FBaseHead.astro
Participation
The text was updated successfully, but these errors were encountered: