Repository navigation
Conversation
Scroll events of elements do not bubble to window, so the holes of targets in an inner scroll container, e.g. a scrolling wrapper or body as scroll container, stayed in place when the container scrolled. The overlay then covered the moved target, and its old place was clickable. A target scrolled out of its container also opened a hole over the content outside the container. The scroll listener captures the scroll events at the document, and targets in an inner scroll container count as depending on scrolling. Their holes are clipped to the visible area of their scroll containers.
The overflow of body applies to the viewport while html has none, e.g.
with the common `body {overflow-x: hidden}`. body then counted as inner
scroll container: every hole was clipped to the box of body, and with
`html, body {height: 100%}` targets below the first screen could not be
clicked anymore.
The root element and body with an overflow that applies to the viewport
are no inner scroll containers anymore. body as real scroll container,
with an overflow on html, still is.
Kanti
force-pushed
the
bugfix/spotlight-scroll-containers
branch
from
November 9, 2026 16:29
18ee528 to
6acd167
Compare
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.
Stacked on #161. Switch the base to
mainafter #161 is merged.Problem
The hole of a target inside an inner scroll container (an element with
overflow: auto/scroll, e.g. a scrolling wrapper orbodyas scroll container) stayed in place when the container scrolled, because scroll events of elements do not bubble towindow. The overlay then covered the moved target, and its old place was clickable. A target scrolled out of its container also opened a hole over the content outside the container. 1.10.4 behaved the same, so this is an improvement, not a regression fix.Implemented behavior
document.addEventListener('scroll', …, {capture: true, passive: true}), which catches scrolling of the document and of elements, and removed with the matchingcapture.overflow-xoroverflow-yisauto,scrolloroverlayand the content is larger than the element), exceptdocument.scrollingElement, depend on scrolling like sticky and fixed targets ([BUGFIX] Only follow scrolling for sticky and fixed spotlight targets #161). This is still checked when the targets are selected; without such targets, scrolling runs no code.body {overflow-x: hidden}), are no inner scroll containers.Tests
spotlight-overlay.test.js(browser), with aheight: 300px; overflow: autocontainer:html, body {height: 100%} body {overflow-x: hidden}, highlighted elements below the first screen stay clickable after scrolling the page. Fails without the fix for body.html {overflow: hidden}), the holes follow the scrolling of body. This test guards the fix for body and passes before it as well.getBoundingClientRectcalls while scrolling, sticky and fixed targets, header fixed by a script) stay green.npm run test: 97 passing,npm run lint