Skip to content

fix(theme): handle outline bottom overscroll - #5375

Merged
brc-dd merged 2 commits into
mainfrom
outline-overscroll
Aug 18, 2026
Merged

fix(theme): handle outline bottom overscroll#5375
brc-dd merged 2 commits into
mainfrom
outline-overscroll

Conversation

@bluwy

@bluwy bluwy commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Description

When reaching the bottom of the page, the outline marker will always mark the last item. However, on Safari where you can overscroll the bottom (which have the elastic effect), the Math.abs was preventing the detection for values that would go negative because of the overscroll.

This PR updates the calculation to account for overscroll, so that the marker doesn't jump between the last and second last item during overscroll

Linked Issues

n/a

Additional Context

You can check the outline marker behaviour during overscroll like on this page: https://vitepress.dev/guide/i18n


Tip

The author can publish a preview release by commenting /publish after creating the PR.

const innerHeight = window.innerHeight
const offsetHeight = document.body.offsetHeight
const isBottom = Math.abs(scrollY + innerHeight - offsetHeight) < 1
const isBottom = scrollY + innerHeight - offsetHeight >= 0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you scroll from top to bottom, the value (without abs) goes something like this:

  • -1000 (top) -> 0 (bottom) -> +50 (max overscrolled bottom)

@brc-dd
brc-dd merged commit 3fe901d into main Aug 18, 2026
9 checks passed
@brc-dd
brc-dd deleted the outline-overscroll branch August 18, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants