Skip to content

[BUGFIX] Follow spotlight targets that scripts move while scrolling - #164

Merged
Kanti merged 1 commit into
mainfrom
bugfix/spotlight-follow-moved-ancestors
Nov 9, 2026
Merged

Kanti merged 1 commit into
mainfrom
bugfix/spotlight-follow-moved-ancestors

Conversation

@Kanti

@Kanti Kanti commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #161 and #162, before the next release.

Problem

Since #161, the spotlight holes only follow the scrolling for sticky and fixed targets and for targets in scroll containers. A class or style change of an ancestor of the targets only recomputed the holes when it started or stopped this. Targets that a script moves while scrolling kept their old holes, and the overlay covered them:

  • a parallax effect that sets a transform on a section while scrolling,
  • a reveal effect that removes a class with an offset from a section once it is scrolled into view.

1.10.4 recomputed all holes on every scroll event, so these targets stayed clickable there. #144 is not released yet, so this would be a regression in the next release.

Implemented behavior

  • A class or style change of an ancestor of the targets recomputes the holes, at most once per frame, and still checks whether the holes have to follow the scrolling.
  • Pages whose scripts do not change the ancestors of the targets still run no code while scrolling. Pages whose scripts do, recompute the holes per frame, as 1.10.4 did on every page.
  • Not covered, as in 1.10.4: elements that keep moving after the last change, e.g. through a CSS transition of a reveal effect, and CSS scroll-driven animations.

Tests

  • spotlight-overlay.test.js (browser):
    • A script that moves the section of the target by a style while scrolling: the target stays clickable, the element next to it stays blocked. Fails without the fix, passes with the spotlight of 1.10.4.
    • The same with a class that a script removes while scrolling. Fails without the fix, passes with the spotlight of 1.10.4.
  • The test for static targets (no getBoundingClientRect call while scrolling) and all other spotlight tests stay green.
  • npm run test: 101 passing, npm run lint

Since #161, the holes only followed the scrolling for sticky and fixed
targets and targets in scroll containers. A class or style change of an
ancestor only recomputed the holes when it started or stopped this. So
targets that a script moves while scrolling, e.g. a parallax effect that
sets a transform on a section, or a reveal effect that removes a class
with an offset, kept their old holes, and the overlay covered them.
1.10.4 recomputed the holes on every scroll event and followed them.

A class or style change of an ancestor of the targets recomputes the
holes now, at most once per frame. Pages without such changes still run
no code while scrolling.
@Kanti
Kanti merged commit 4b80e33 into main Nov 9, 2026
33 checks passed
@Kanti
Kanti deleted the bugfix/spotlight-follow-moved-ancestors branch November 9, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant