Skip to content

Commit 46b0794

Browse files
lfranckeclaude
andcommitted
fix: Guard against a missing toolbar in the fragment jumper
Companion to upstream's def7144, which guards the same script against a missing article.doc. Upstream needs no toolbar guard because every one of its layouts has one; our landing layout does not, so jumpToAnchor could throw on a page that has an article but no toolbar. Treats an absent toolbar as a zero offset rather than returning early, so anchor links keep working instead of silently doing nothing. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 39f4932 commit 46b0794

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ui/src/js/03-fragment-jumper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
window.location.hash = '#' + this.id
2121
e.preventDefault()
2222
}
23-
var y = computePosition(this, 0) - toolbar.getBoundingClientRect().bottom
23+
var y = computePosition(this, 0) - (toolbar ? toolbar.getBoundingClientRect().bottom : 0)
2424
var instant = e === false && supportsScrollToOptions
2525
instant ? window.scrollTo({ left: 0, top: y, behavior: 'instant' }) : window.scrollTo(0, y)
2626
}

0 commit comments

Comments
 (0)