From 463f76cb0becf3ee76e38548ace5a07d9f7c93db Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 9 Oct 2018 08:02:53 +0200 Subject: [PATCH] embed: do not jump to unrelated anchor on load When loading, Isso scrolls to the current document hash. This makes sense when the document hash references a comment, but this doesn't for an unrelated anchor. Tell Isso to only scroll for a comment. --- isso/js/embed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/isso/js/embed.js b/isso/js/embed.js index 4e796c1..e6b3e82 100644 --- a/isso/js/embed.js +++ b/isso/js/embed.js @@ -71,7 +71,8 @@ require(["app/lib/ready", "app/config", "app/i18n", "app/api", "app/isso", "app/ isso.insert_loader(rv, lastcreated); } - if (window.location.hash.length > 0) { + if (window.location.hash.length > 0 && + window.location.hash.match("^#isso-[0-9]+$")) { $(window.location.hash).scrollIntoView(); } },