solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

Scroll bug in SolidStart HN demo

Open redbar0n opened this issue 3 years ago • 7 comments

Why:

A small nitpicky bug, but which gives a bad impression of SolidStart. I don't think it's a bug in SolidStart, more likely a bug in the HN demo, but it's hard to tell. Viewers may conclude it's a bug in SolidStart, which would give an unnecessary bad impression.

Reproduce:

  1. Go to https://solid-hackernews-edge.netlify.app/ or https://solid-start-hn.netlify.app/
  2. Click into comments of first post
  3. Scroll down
  4. Click browser back button

Effect:

The header of the post flashes briefly before you get back to the main page.

Cause:

It scrolls to the top, before going to the previous page.

Expected result:

Go directly back to main page. Then set the scoll position.

redbar0n avatar Aug 07 '22 22:08 redbar0n

@ryansolid, @rturnq can you look at this? why would this be happening?

nksaraf avatar Aug 08 '22 08:08 nksaraf

That shouldn't happen until after the transition but maybe it applies first. This is the scroll restoring behavior of the router.

ryansolid avatar Aug 08 '22 19:08 ryansolid

What would cause this bug, the hackernews demo is the same one we have always had

nksaraf avatar Aug 09 '22 08:08 nksaraf

It's probably always been there. I don't always notice details like this.

ryansolid avatar Aug 09 '22 15:08 ryansolid

How would we fix this.. there is no userland transition code involved.. so must be one of our libraries?

nksaraf avatar Aug 09 '22 18:08 nksaraf

~~It doesn't seem to happen on my side, using MacOS 12.5 with Google Chrome. I'm taken directly to the home page on browser back.~~

Oops, my bad, I see it now. One thing to note is if I scroll on the home page, click comments of a post, scroll down, and then browser back, the scroll postition of main page is also maintained.

lightyaer avatar Aug 10 '22 02:08 lightyaer

It actually doesn't do this in my CSR demo which should be same mechanism. So I thought it must be related to router version.. but it's not. I have older versions of SolidStart with this behavior too.

It's interesting because you wouldn't think there would be a difference here because once you are client side these are essentially equivalent.. But I notice some difference in behavior. The CSR version doesn't retain scroll when pressing forward.. it resets. So there is something more going on that needs investigation.

ryansolid avatar Dec 21 '22 21:12 ryansolid