Skip to content

Commit

Permalink
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -55,4 +55,19 @@ const onClientEntry = () => {
window.ReactDOM = require('react-dom');
};

export { wrapPageElement, onInitialClientRender, onClientEntry };
const shouldUpdateScroll = ({ routerProps: { location } }) => {
const transitionDelay = 600;

// Scroll window to top position if there is no search (i.e., page load)
if (!location.search) {
window.setTimeout(() => window.scrollTo(0, 0), transitionDelay);
}
return false;
};

export {
wrapPageElement,
onInitialClientRender,
onClientEntry,
shouldUpdateScroll,
};

0 comments on commit ef22eb2

Please sign in to comment.