-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Page scrolls down on load #4065
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
Comments
to get rid of this issue, create a |
This code doesn't work unless I add a small delay. I also had to either scroll to the import { browser } from '$app/env';
if (browser) {
setTimeout(() => {
document.scrollingElement.scrollIntoView();
}, 100);
} I haven't been able to get this to work properly with just CSS. |
The description should mention that this issue is dependent on using disableScrollHandling might be part of a work-around. This looks like a promising place to start messing around: I'm new to SvelteKit so I can't immediately dive in to this, I'll try to circle back to it. |
Ah, that might explain why I had some trouble reproducing it at first |
This regressed in b622888. As far as I can tell, it's only reproducible on Safari SPA reload (or tab reopen), not on internal navigation. I'm thinking perhaps L302 could change to But actually, as far as I understand, this code resets focus on page navigation and then restores the original tabIndex. Forgive the ignorance (also new to SvelteKit), but does this code even need to run on a SPA refresh? |
@timothycohen, I tested:
... And it resolved the issue! 🎉 I ran tests before and after, alas I wasn't able to run all tests before, but promisingly, no new failures after. FYI, Playwright tests are running in Chromium only, so this bug wouldn't be captured by tests, since it only occurs in WebKit |
Ahh, yes, that was me in the discord. I was able to create a fail/pass test only by adding webkit to the Playwright config, and doing so exposed 13 other failing tests. Not sure how the core team wants to handle that, but I'm going to take a look at the other failing webkit enabled tests. |
I have the same issue when loading sumsub's widget in iframe.. Not sure how to reproduce it :( |
Describe the bug
When the page loads, the window scrolls down to the first element. This means that the
margin-top
applied above the first element is skipped over.Reproduction
https://github.com/ezfe/scroll-issue-reproduction
Use
npm run dev
and open the page. The text will appear at the top of the screen, with themargin-top
scrolled up above the top of the screen.Appears to only happen in Safari.
Logs
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: