docs: Firefox - Switching between pages scroll does not reset to top
On which page do you see this issue?
https://daisyui.com/docs/themes/
Describe the issue
Scroll to the bottom of https://daisyui.com/docs/themes/ then click on Base Style
From my tests this appears to be only issue on Firefox (135.0.1)
There is no errors in console either.
What browsers are you seeing the problem on?
Firefox
Thank you @AiAe
for reporting issues. It helps daisyUI a lot ๐
I'll be working on issues one by one. I will help with this one as soon as a I
find a solution.
In the meantime providing more details and reproduction links would be
helpful.
This is not an issue only in the Base Style but it depends on the source page scrolled position and the destination page maximum scroll depth. This appears to be a known Firefox-specific issue with scroll position restoration when navigating between pages of differing heights. As documented in https://github.com/swup/swup/issues/95, Firefox sets the scroll position before content replacement, which causes problems specifically when navigating from a longer page (where you've scrolled down significantly) to a shorter page.
@saadeghi I've tried several approaches without success:
- Adding
window.scrollTo(0, 0)inonNavigatehandler - Using
afterNavigatewithsetTimeoutto force scroll reset
also check this out: https://lightrun.com/answers/sveltejs-kit-page-scroll-position-not-reset-to-top-on-navigation-regression
FWIW, I came here to report this issue. I noticed this because I had read all the way to the bottom of the Introduction page and then clicked the Install page and noticed I had not scrolled to the top.
I'm also using Firefox.
(firefox) this also happens in here https://daisyui.com/docs/install/ while looking into different pages