Single page scrollbar with google-docs comment placement#7
Closed
AnnaXWang wants to merge 2 commits into
Closed
Conversation
Size the sandboxed iframe to the document's full content height (from the overlay's docHeight report) so it never scrolls internally — the page owns the one scrollbar. The comment rail stops being a separately-scrolling column: it becomes a transparent margin column whose cards sit at their highlight's document Y and scroll with the page. Drop the JS scroll-sync, make the chrome bar sticky, fix the mobile drawer to the viewport, and move scroll-to-highlight into the shell (the iframe can no longer scroll itself). Keep docHeight fresh via a ResizeObserver in the overlay for late images.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The overlay fires jh:ready when its script runs, which can beat the shell's message listener — the SSR'd iframe starts fetching before React hydrates — and a missed ready meant anchors were never sent, so no highlights painted. The overlay already answers jh:ping with jh:ready; have the shell ping every 250ms until the handshake lands.
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
The comments viewer had two scrollbars: the document scrolled inside its sandboxed iframe, and the comment rail scrolled separately (kept in lockstep by a JS scroll-sync). This makes the scroll behavior work like Google Docs:
jh:positions.docHeight) and the shell sizes the iframe to it, so the iframe never scrolls internally — the page scrolls the document.scrollIntoViewpropagation) — replaces the overlay-sidescrollTo, which is removed.docHeightvia aResizeObserveronbodyso late-loading images/fonts keep the iframe sized correctly.jh:readywhen its script runs, which can beat the shell's message listener (the SSR'd iframe starts fetching before React hydrates); a missed ready meant anchors never painted. The shell now sendsjh:pingevery 250ms until the overlay answers — the ping reply already existed in the overlay protocol but was never used.docScrollY/scrollYplumbing,viewTop,jh:scrollTo.Test plan
npm run buildandnpm test(108 tests) pass. Verified end-to-end in headless Chromium against a local Postgres +next dev, with a seeded long doc (~5400px) carrying comments anchored at the top, middle, and bottom — 18/18 checks:overflow: visiblewith zero scroll range, no horizontal overflow)🤖 Generated with Claude Code