From ee6a2ee0c41ec6bce62ee22fe662de3b8b0b4a12 Mon Sep 17 00:00:00 2001 From: Nikola Pavlovic Date: Fri, 28 Aug 2020 17:01:30 +0200 Subject: [PATCH 1/3] change hash without affecting the rest of URL Closes #9955 . Hash change currently replaces history state url with only the updated hash, ignoring the current URL (path, query parameters etc). This PR fixes the hash change method, so that it updates only the fragment (part in case of a named fragment parameter), while leaving the rest of URL untouched. --- src/ui/hash.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/hash.js b/src/ui/hash.js index 78202ae79bd..121d91fa704 100644 --- a/src/ui/hash.js +++ b/src/ui/hash.js @@ -132,9 +132,10 @@ class Hash { } _updateHashUnthrottled() { - const hash = this.getHashString(); + // Replace if already present else append the updated hash string + const location = window.location.href.replace(/(#.+)?$/, this.getHashString()); try { - window.history.replaceState(window.history.state, '', hash); + window.history.replaceState(window.history.state, document.title, location); } catch (SecurityError) { // IE11 does not allow this if the page is within an iframe created // with iframe.contentWindow.document.write(...). From 2e6242a283ce0b6904d952e1fbdee00635bf274f Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Mon, 31 Aug 2020 11:56:28 +0300 Subject: [PATCH 2/3] bump the branch to try to trigger Circle CI --- src/ui/hash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/hash.js b/src/ui/hash.js index 121d91fa704..b6a9e7170b9 100644 --- a/src/ui/hash.js +++ b/src/ui/hash.js @@ -132,7 +132,7 @@ class Hash { } _updateHashUnthrottled() { - // Replace if already present else append the updated hash string + // Replace if already present, else append the updated hash string const location = window.location.href.replace(/(#.+)?$/, this.getHashString()); try { window.history.replaceState(window.history.state, document.title, location); From 4fae6b6f321bc52cbd2570d17cf611327d623bff Mon Sep 17 00:00:00 2001 From: Nikola Pavlovic Date: Tue, 1 Sep 2020 13:21:41 +0200 Subject: [PATCH 3/3] use null in place of document.title null will default to document.title --- src/ui/hash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/hash.js b/src/ui/hash.js index b6a9e7170b9..82d98153b51 100644 --- a/src/ui/hash.js +++ b/src/ui/hash.js @@ -135,7 +135,7 @@ class Hash { // Replace if already present, else append the updated hash string const location = window.location.href.replace(/(#.+)?$/, this.getHashString()); try { - window.history.replaceState(window.history.state, document.title, location); + window.history.replaceState(window.history.state, null, location); } catch (SecurityError) { // IE11 does not allow this if the page is within an iframe created // with iframe.contentWindow.document.write(...).