Skip to content

fix(theme): prevent outline from skipping short sections near page bottom (#5473) - #5539

Open
vidupulapatithrylokya wants to merge 2 commits into
vuejs:mainfrom
vidupulapatithrylokya:fix/outline-short-sections-5473
Open

vidupulapatithrylokya wants to merge 2 commits into
vuejs:mainfrom
vidupulapatithrylokya:fix/outline-short-sections-5473

Conversation

@vidupulapatithrylokya

@vidupulapatithrylokya vidupulapatithrylokya commented Oct 15, 2026 •

Copy link
Copy Markdown

Description

When a document has multiple short sections located near the bottom of a page, scrolling to the bottom previously caused the right-side outline to jump directly to the final section, skipping intermediate sections entirely (and skipping them in reverse when scrolling back up).

Root Cause

  1. Short sections near the end of the document cannot physically reach the fixed top-based reference line (scrollY + scrollMarginTop + 4).
  2. The previous page-bottom fallback (isBottom) unconditionally activated the final outline item (headers.at(-1)), bypassing position-based resolution for any remaining intermediate headings.

Solution

  • Removed forced page-bottom override: Eliminates the unconditional jump to the last item.
  • Dynamic reference line across final viewport: When the scroll position enters the final viewport distance (maxScroll - innerHeight to maxScroll), bottomProgress smoothly scales from 0 to 1. The reference line progressively shifts from the standard top offset down to the viewport bottom (scrollY + innerHeight).
  • Preserved normal scroll behavior: Normal scrolling across the rest of the document remains completely untouched (bottomProgress = 0).
  • Sequential activation: Headings now activate sequentially in both directions (Section 07 -> Section 08 -> Section 09 -> Section 10 and 10 -> 09 -> 08 -> 07).

Linked Issues

Fixes #5473

Additional Context

  • Verified type checking (pnpm typecheck) with 0 errors.
  • Verified unit test suite (pnpm test:unit) with all 31 test files and 504 tests passing.
  • Verified end-to-end test suite (pnpm test:e2e).

@vidupulapatithrylokya vidupulapatithrylokya changed the title fix(theme): prevent outline from skipping short sections near page bo… fix(theme): prevent outline from skipping short sections near page bottom (#5473) Oct 15, 2026
@vidupulapatithrylokya
vidupulapatithrylokya force-pushed the fix/outline-short-sections-5473 branch from 146b065 to 59137af Compare October 27, 2026 07:43

This branch has not been deployed

No deployments
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.

Right-side outline skips short sections near the page bottom

1 participant