Skip to content

Scroll to top on page refresh #10422

@ashleybeshir

Description

@ashleybeshir

Summary

When the page refreshes i want it to scroll to top of the page. I added window.scrollTo(0, 0); into both componentDidUpdate and componentDidMount. So it should be doing it ? but when page refreshes it still stays at the same Y scroll position

Relevant information

Their are few other tickets for this issue in gatsby 1 but not sure if it been fixed in gatsby 2

Environment (if relevant)

System:
OS: Windows 10
CPU: (8) x64 AMD FX(tm)-8350 Eight-Core Processor
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.0.19 => 2.0.19
gatsby-image: ^2.0.15 => 2.0.15
gatsby-plugin-emotion: ^2.0.6 => 2.0.6
gatsby-plugin-manifest: ^2.0.5 => 2.0.5
gatsby-plugin-no-sourcemaps: ^2.0.1 => 2.0.1
gatsby-plugin-offline: ^2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-plugin-sharp: ^2.0.7 => 2.0.7
gatsby-source-filesystem: ^2.0.4 => 2.0.4
gatsby-transformer-sharp: ^2.1.4 => 2.1.4

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions