Repository navigation
docs(demos): keep tour spotlight on its target while scrolling - #162
Merged
Merged
Conversation
This was referenced Oct 16, 2026
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.
On the demo pages, the guided-tour spotlight (dim panels, ring and coach card) stayed where it was on screen when you scrolled, so the bright hole drifted off its target.
The tour measured the targets with
getBoundingClientRect()once per step and positionedposition: fixedelements from that, with nothing listening for scroll or resize.makeTournow keeps the current step's target nodes and, while a step is open, recomputes the spotlight and coach position onscroll(capture, so nested scroll containers count too) andresize, at most once per animation frame. The listeners are removed when the step closes or the demo resets. All mount modes (single client, herd, full stack) sharemakeTour, so they all get the fix.Re-placing the coach on scroll can switch which side it sits on more often, so the arrow's border overrides are now cleared before each placement. Otherwise borders from the previous side could carry over.
I considered switching the overlay to
position: absolutein document coordinates. It would scroll with the page on its own, but the full-screen dim panels and the coach's viewport clamping would need reworking, so re-measuring is the smaller change.Testing
The repo has no JS test harness, so I checked this with a throwaway headless Playwright script against
mkdocs serve. It plays each demo until the first stop, scrolls 120px, and measures how far the ring moved:mkdocs build --strictpasses.