I'm getting back into web development after a break, focusing on creating simple, optimized static sites. I've noticed that the ability to preserve scroll positions during page refreshes seems to be less prevalent now. It feels like preferences from single-page application (SPA) developers have overshadowed this functionality, which is frustrating for someone like me who prefers traditional web approaches. I'm working on a static site compiler that allows for features like recursively including HTML files while maintaining relative paths, aiming to improve the experience for basic static sites. If anyone has a quick and robust solution for maintaining scroll position, I'd really appreciate it!
3 Answers
From my standpoint, when I hit refresh on a website, I actually prefer being taken back to the top. If it keeps the scroll where I left off, it feels off to me. But I get that not everyone feels the same way!
Isn’t scroll preservation kind of a vague expectation? Most browsers handle it well when moving between static pages. It gets trickier with SPAs where data loads asynchronously. So, it’s understandable that things might feel different depending on the context you’re in.
I think you're on to something. The scrolling issue is definitely not just a simple browser quirk; it could depend on how the content is loaded.
Honestly, it seems like some of the issues you're experiencing are due to changes in specific browsers, especially if you've been away for a while. For instance, Safari has had scroll position bugs for a while, especially since Chrome 87 onward. They might not be general changes, just quirks in those particular browsers.
Yeah, it's easy to forget about those quirks when you take a break from development! You might be noticing changes related to your specific setup.
Absolutely, especially during development. Most of us are refreshing pages often, and the behavior feels more intuitive that way.