Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
help_pages: Preserve anchor highlights.
Karl Stolleyb852da6eedc5
diff --git a/web/src/portico/help.js b/web/src/portico/help.jsindex c2666c89ca9..a109b73b57b 100644--- a/web/src/portico/help.js+++ b/web/src/portico/help.js@@ -70,6 +70,10 @@ function scrollToHash(simplebar) {const scrollbar = simplebar.getScrollElement();if (hash !== "" && $(hash).length > 0) {const position = $(hash).position().top - $(scrollbar.firstChild).position().top;+ // Preserve a reference to the scroll target, so it is not lost (and the highlight+ // along with it) when the page is updated via fetch+ const $scroll_target = $(hash);+ $scroll_target.addClass("scroll-target");scrollbar.scrollTop = position;} else {scrollbar.scrollTop = 0;diff --git a/web/styles/portico/portico.css b/web/styles/portico/portico.cssindex 68b4d20a586..e5d35c153e8 100644--- a/web/styles/portico/portico.css+++ b/web/styles/portico/portico.css@@ -249,7 +249,8 @@ html {width: calc(100vw - 300px);height: calc(100vh - 59px);- & :target {+ & :target,+ & .scroll-target {/* Match to where simplebar scrolls */scroll-margin-top: 20px;/* Increase the highlighted space around the text... */