feat(viewer): land revealed inline comment highlight ~1/3 down the viewport#578
Merged
Conversation
…ewport Opening an inline-comment deep link (#comment-<id>), or stepping to an inline comment with n/p, now lands the highlighted passage about a third of the way down the viewport instead of dead-center — where the eye rests on arrival, with room above for the comment thread. Switch the inline-highlight reveal (both the deeplink path and the n/p keyboard nav call site) from scrollIntoView block:"center" to block:"start", and add scroll-margin-top: 33vh to the rw-annotation highlight element. This uses the browser-native scroll-margin mechanism (the codebase's existing idiom for scroll positioning) rather than manual scrollTo math, so it works whether the window or an embedding host owns the scroll container. Tests: e2e asserts the deeplinked highlight lands ~1/3 down (the getting-started fixture is lengthened so the page genuinely scrolls and 33vh engages); the n/p nav test guards that the highlight is no longer centered. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Opening an inline-comment deep link (
#comment-<id>), or stepping to an inline comment withn/p, now lands the highlighted passage about a third of the way down the viewport instead of dead-center — where the eye rests on arrival, with room above for the comment thread.What changed
n/pkeyboard-nav call site) switches fromscrollIntoView({ block: "center" })toblock: "start".rw-annotationgetsscroll-margin-top: 33vh, so the highlight's top lands ~⅓ down the viewport.This uses the browser-native
scroll-marginmechanism (the codebase's existing idiom for scroll positioning — headings already usescroll-margin-top) rather than manualscrollTomath, so it works whether the window or an embedding host (Backstage) owns the scroll container. Page-level/resolved comment deeplinks are unchanged.Testing
getting-startedfixture is lengthened so the page genuinely scrolls and the 33vh offset actually engages.n/pnav test guards that the highlight is no longer centered.🤖 Generated with Claude Code