Skip to content

Commit 3c7d8ab

Browse files
authored
fix: workaround replaceState bug in Safari (#2295)
Fix #2195 <!-- Please make sure to read the Pull Request Guidelines: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#pull-request-guidelines -->
1 parent 19b1cd6 commit 3c7d8ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/scroll.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const positionStore = Object.create(null)
88

99
export function setupScroll () {
1010
// Fix for #1585 for Firefox
11-
window.history.replaceState({ key: getStateKey() }, '')
11+
// Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
12+
window.history.replaceState({ key: getStateKey() }, '', window.location.href.replace(window.location.origin, ''))
1213
window.addEventListener('popstate', e => {
1314
saveScrollPosition()
1415
if (e.state && e.state.key) {

0 commit comments

Comments
 (0)