Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
set history.scrollRestoration as manual if scroll enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kaesonho committed Oct 21, 2015
1 parent 036b32e commit faf291b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/handleHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ function createComponent(Component, opts) {
});
}
}

if (options.enableScroll && window.history) {
// https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration?hl=en
// disable browser auto scroll behavior with popstate
window.history.scrollRestoration = 'manual';
}

this._history.on(this._onHistoryChange);

window.addEventListener('scroll', this._onScroll);
Expand Down

0 comments on commit faf291b

Please sign in to comment.