Skip to content

Conversation

@SubsequentlySneeds
Copy link

Fixes #263

When scrolling inside an internal scrollable element or on pages with custom scrolling behavior, highlight overlays would desync from their target element. This fixes the issue by watching for relevant events and reattaching the overlays for a short period. One final attempt is delayed to catch even longer scrolling animations.

If performance suffers on low-end devices, toRunEachFrame(updateHighlightOverlayPositions, 200, 1000) can be changed to a simple requestAnimationFrame(updateHighlightOverlayPositions) to fix internal element scrolling (such as Obsidian web pages), but pages that intercept wheel events and do custom scrolling (like Grok) will remain desynced. If performance is not an issue, toRunEachFrame can be changed to run for a longer period or indefinitely.

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.

BUG: Highlight did not stick to paragraph when scrolling

1 participant