From 50703db8790871d6b9d1c86adde86e9c5cbe130f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 5 Jun 2020 18:24:11 -0400 Subject: [PATCH] fix: #8363, dont break history --- public/src/client/topic.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index e12413328a..00e69eb65a 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -116,14 +116,16 @@ define('forum/topic', [ }; function handleBookmark(tid) { - // use the user's bookmark data if available, fallback to local if available + if (window.location.hash) { + var el = $(utils.escapeHTML(window.location.hash)); + if (el.length) { + return navigator.scrollToElement(el, true, 0); + } + } var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark'); var postIndex = ajaxify.data.postIndex; - if (window.location.hash) { - var hash = window.location.hash; - window.location.hash = ''; - window.location.hash = hash; - } else if (postIndex > 1) { + + if (postIndex > 1) { if (components.get('post/anchor', postIndex - 1).length) { return navigator.scrollToPostIndex(postIndex - 1, true, 0); }