fix(review): work around Safari scroll-reset bug with shadow DOM diffs#547
Merged
backnotprop merged 1 commit intomainfrom Apr 12, 2026
Merged
fix(review): work around Safari scroll-reset bug with shadow DOM diffs#547backnotprop merged 1 commit intomainfrom
backnotprop merged 1 commit intomainfrom
Conversation
#540) Safari's compositor resets scrollTop to 0 when momentum-scrolling ends inside a container whose child is a web-component shadow DOM (the @pierre/diffs `<diffs-container>`). The reset bypasses all JavaScript APIs — neither scrollTo nor the scrollTop setter fires. Add a WebKit-only scroll event listener that detects the bogus reset (scrollTop jumping from >200 to 0 in a single event, which cannot happen during normal scrolling) and synchronously restores the last known good position before the browser paints the wrong frame. Closes #540 For provenance purposes, this commit was AI assisted.
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.
Summary
scrollTopresets to 0 when momentum-scrolling ends inside a scroll container with a<diffs-container>shadow DOM childRoot cause
Safari's compositor loses track of scroll position when a web-component shadow DOM (
@pierre/diffs<diffs-container>) is the child of a scroll container. The reset bypasses all JavaScript APIs — interceptingscrollTo()and thescrollTopsetter caught zero calls. Confirmed via systematic elimination:<div style="overflow:auto">scrollToandscrollTopsetter caught nothing@pierre/diffs— removing the<diffs-container>shadow DOM fixes scrollingTest plan
Closes #540