SCAL-325100 Automate pre-render position tracking via MutationObserver - #604
Open
shivam-kumar-ts wants to merge 9 commits into
Open
SCAL-325100 Automate pre-render position tracking via MutationObserver#604shivam-kumar-ts wants to merge 9 commits into
shivam-kumar-ts wants to merge 9 commits into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
commit: |
shivam-kumar-ts
force-pushed
the
SCAL-325100
branch
from
July 29, 2026 11:29
6f5e73a to
b4167ee
Compare
shivam-kumar-ts
force-pushed
the
SCAL-325100
branch
from
July 30, 2026 04:53
51a229c to
bc2165b
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.
Previously, the pre-render wrapper only repositioned itself when the placeholder was resized or the container was scrolled — any other layout shift (sidebar collapse, banner insertion, window resize) would leave the wrapper misaligned, and developers had to call
syncPreRenderStyle()manually. This PR adds aMutationObserverthat watches the placeholder's ancestor chain for both CSS class/style changes and DOM insertions/removals, awindowresize listener, and routes all three signals through arequestAnimationFramedebounce gate so rapid mutations collapse into a single position measurement taken after the browser finishes layout. The scroll listener is also unified to go through the same rAF path instead of firing on every scroll tick. Together, the wrapper now automatically stays aligned with the placeholder across all common layout shift patterns with no manual developer intervention required.