mirror of https://github.com/zulip/zulip.git
hashchange: Disable scroll position restoration.
This avoids a bug where during a browser initiated hashchange (via back/forward/manually typed URL) browser sets the scroll position of the current hash based on its memory of the scroll position of the new hash.
This commit is contained in:
parent
77f2562cbb
commit
95f8b3a618
|
@ -420,6 +420,10 @@ function hashchanged(from_reload, e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initialize() {
|
export function initialize() {
|
||||||
|
// We don't want browser to restore the scroll
|
||||||
|
// position of the new hash in the current hash.
|
||||||
|
window.history.scrollRestoration = "manual";
|
||||||
|
|
||||||
$(window).on("hashchange", (e) => {
|
$(window).on("hashchange", (e) => {
|
||||||
hashchanged(false, e.originalEvent);
|
hashchanged(false, e.originalEvent);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue