From 0bcaef2e7fb412bd0bbc1ba60449060d3867e5c7 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 30 Sep 2023 00:13:40 +0300 Subject: [PATCH] use history objection instead of location object to stop page from jumping unnecessarily --- files/assets/js/core.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 5bf391232..84099ec11 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -644,10 +644,11 @@ if (screen_width <= 768) { if (object) { object.addEventListener('shown.bs.modal', function (e) { + const new_href = `${location.href.split('#')[0]}#m-${e.target.id}` if (location.hash) - location.replace(`${location.href.split('#')[0]}#m-${e.target.id}`); + history.replaceState({}, '', new_href) else - location.hash = `m-${e.target.id}`; + history.pushState({}, '', new_href) }); object.addEventListener('hide.bs.modal', function (e) {