Skip to content

[BUGFIX] Keep spotlight holes on sticky and fixed elements while scrolling - #159

Merged
Kanti merged 1 commit into
mainfrom
bugfix/spotlight-sticky-elements
Nov 9, 2026
Merged

Kanti merged 1 commit into
mainfrom
bugfix/spotlight-sticky-elements

Conversation

@Kanti

@Kanti Kanti commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since the spotlight overlay is anchored to the document (#144), nothing updates its holes while scrolling. Sticky and fixed elements move within the document when the page scrolls, so after scrolling the overlay covers them and they cannot be clicked anymore, e.g. editable content in a sticky header. In 1.10.4, the holes followed the scrolling.

Implemented behavior

  • A passive scroll listener recomputes the holes again, at most once per frame and without measuring the document.
  • The holes of all other elements keep their document coordinates, so the overlay path is not rewritten for them. The holes are still recomputed on every scroll frame though, on every page, so scrolling runs script again, unlike after [BUGFIX] Fix spotlight overlay stutter on scroll #144. See the follow-up below.

Tests

  • New spotlight-overlay.test.js (browser):
    • Highlighted sticky and fixed elements stay clickable after scrolling, while an element that is not highlighted stays blocked. This test fails without the fix.
    • Scrolling a page with only static targets does not rewrite the overlay path.
  • npm run test: 91 passing, npm run lint

Follow-up

…lling

Since the overlay is anchored to the document, nothing updated its holes
while scrolling. Sticky and fixed elements move within the document when
the page scrolls, so after scrolling the overlay covered them and they
could not be clicked anymore, e.g. editable content in a sticky header.

Scrolling recomputes the holes again, at most once per frame and without
measuring the document. The holes of all other elements keep their
document coordinates, so the overlay path stays unchanged for them.
@Kanti
Kanti marked this pull request as ready for review November 9, 2026 14:58
@Kanti
Kanti merged commit eeb6f61 into main Nov 9, 2026
33 checks passed
@Kanti
Kanti deleted the bugfix/spotlight-sticky-elements branch November 9, 2026 14:59
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