fix(#3726): highlight last TOC heading when scrolled to bottom#3727
Open
fix(#3726): highlight last TOC heading when scrolled to bottom#3727
Conversation
When the page is scrolled to the bottom, short sections near the end never reach the 120px threshold, so the TOC highlights the wrong item. Detect bottom-of-page and activate the last visible heading instead. https://claude.ai/code/session_01Rcc9hcmnjnE8vdXhiz7VMM
Spark450
reviewed
Mar 31, 2026
Collaborator
Spark450
left a comment
There was a problem hiding this comment.
I think it is certainly working better but it looks like the selection "bounces" a bit then settles.
https://jam.dev/c/08f2e673-e30e-4d7d-a609-a1a81e62637a
Collaborator
Author
I think that's expected for what it's fixing and doing. This is a fix to make it change (override what's set from the scroll position) to the last item if scroll is at the bottom. It's kind of like, it follows the heading based on the scroll position, and then if the scroll is at the bottom, then set it to bottom as active. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handleScroll: whenwindow.innerHeight + window.scrollY >= document.body.scrollHeight - 10, the last visible heading is set as active instead of relying on the 120px thresholdScreen.Recording.2026-03-31.at.3.07.21.PM.mov
Closes #3726
Test plan
https://claude.ai/code/session_01Rcc9hcmnjnE8vdXhiz7VMM