Skip to content

Undesirable scroll-to-top on page refresh #551

@Cinamonas

Description

@Cinamonas

First of all, thanks for React-Static – it’s great 👏

There’s one undesirable effect, though:

If I scroll down the page and refresh it, after the refresh the page scrolls back to the top with an animation (this can be seen on react-static.js.org). And I expect scroll position to stay exactly where it was before the refresh – that’s how it behaves on browsers out of the box.

I’m aware of props that are available on Router component, but I was still not able to work around this behaviour:

  • If I set autoScrollToTop={false}, I lose auto scroll-to-top when the site path changes. Interestingly, it does not fix the scroll-to-top on page refresh, which still happens with this prop off.
  • If I set autoScrollToHash={false}, the issue disappears, but then I lose animated scroll to hash, which some of my pages use. So it seems that scroll to hash is triggered on page refresh and that makes the page scroll back to the top.

Do you agree that this should be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement 🦄Changing current behaviour, enhancing what's already there

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions