Right-side outline skips short sections near the page bottom
Describe the bug
When multiple short sections are located near the bottom of a page, scrolling to the bottom makes the right-side outline jump directly to the final item. Intermediate items are skipped and never become active.
The attached video shows the outline jumping from Section 07 directly to Section 10, skipping Section 08 and Section 09. The same items are skipped when scrolling back up.
The current bottom special case unconditionally activates the final outline item:
if (isBottom) {
activateLink(headers.at(-1)?.link ?? null)
return
}Short sections near the end of the page cannot reach the fixed top-based reference line, so this branch bypasses the normal position-based selection.
Reproduction
- Create a long page with multiple equal-height sections, such as
Section 01throughSection 10. - Scroll until
Section 07becomes active in the right-side outline. - Continue scrolling to the bottom.
- Observe that the active item jumps directly to
Section 10. - Scroll back up and observe the same skipped items.
https://github.com/user-attachments/assets/76eb6b51-2bae-4eb7-bb57-ca619b0e112c
Expected behavior
The active outline item should advance sequentially:
Section 07 -> Section 08 -> Section 09 -> Section 10
It should return in the reverse order without skipping intermediate sections.
System Info
System:
OS: macOS 27.0
CPU: (10) arm64 Apple M4
Memory: 121.52 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 26.4.0 - /usr/local/bin/node
npm: 12.0.2 - /usr/local/bin/npm
pnpm: 11.24.0 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 153.0.8010.53
Safari: 27.0
Additional context
The issue occurs because the active item is determined by whether a heading has crossed a fixed top-based line, while the page-bottom fallback ignores the remaining intermediate headings. A focused fix could preserve the existing behavior during normal scrolling and smoothly move the reference line downward only within the final viewport.
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Source: vuejs/vitepress