Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettJephson committed Sep 24, 2024
1 parent 7a89d3e commit ef7e856
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pink-feet-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Include offset in calculations of whether scrollable element is in view
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ function isOutOfView(tocItem: HTMLElement, tocContainer: HTMLElement) {
const tocItemTop = tocItem.offsetTop;
const containerTop = tocContainer.scrollTop;
const containerBottom = containerTop + tocContainer.clientHeight;
return tocItemTop < containerTop + TOC_ITEM_OFFSET || tocItemTop > containerBottom - TOC_ITEM_OFFSET;
return (
tocItemTop < containerTop + TOC_ITEM_OFFSET ||
tocItemTop > containerBottom - TOC_ITEM_OFFSET
);
}

0 comments on commit ef7e856

Please sign in to comment.