mirror of https://github.com/zulip/zulip.git
help: Fix exception with invalid fragment causing bogus extra scrollbars.
Apparently, our scrollbar logic crashed with an invalid URL fragment (hash), which resulted in initialization not completing and thus the logic failing. In my view the root issue here is that we're not doing a good job of catching JavaScript exceptions in portico pages. Fixes #15706.
This commit is contained in:
parent
f364414cb9
commit
42d601e214
|
@ -56,7 +56,7 @@ function render_code_sections() {
|
|||
function scrollToHash(simplebar) {
|
||||
const hash = window.location.hash;
|
||||
const scrollbar = simplebar.getScrollElement();
|
||||
if (hash !== '') {
|
||||
if (hash !== '' && $(hash).length > 0) {
|
||||
const position = $(hash).position().top - $(scrollbar.firstChild).position().top;
|
||||
scrollbar.scrollTop = position;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue