Open koop opened 2 weeks ago
Hey this is really cool, thanks for the PR! I have some stuff to deal with first around getting deferred keyframes into Framer but will check it out after.
We don't need to worry so much about position: sticky
- stickied elements themselves can flick between "fixed" and "static" modes and there's no good way of tracking this. But I'll probably double check we have the tests to check for regressions still.
Sounds good!
We don't need to worry so much about position: sticky - stickied elements themselves can flick between "fixed" and "static" modes and there's no good way of tracking this.
That's roughly what I expected (and why I didn't include it here), monitoring sticky position/state is a pain.
Thank you for making this PR! This could resolve a lot of transition glitches related to position: fixed
.
Fixes the failing
position: fixed;
projection tests added in #1768.Fixes issues #2514, #2006, and #1972.
Details
To handle projecting fixed elements within scrollable pages: as I understand it, the existing logic accounted for scroll root ancestors within
removeElementScroll
by iterating over thepath
, but this didn't account for the case where the current element was a fixed element, because thepath
does not contain the current node. Instead, we now avoid adding the scroll position inmeasurePageBox
when the projection is or is within a fixed element.To handle projected fixed elements within scrollable elements: this was a similar case where we weren't accounting for the current element's scroll information. If the current element is fixed, we can return early from
removeElementScroll
.To handle projecting when an element changes between fixed and static positions: we track whether the position was fixed during the snapshot phase (instead of relying on the most recently measured value) and use that to determine whether the projection considers an element fixed or not. Two considerations here:
position: sticky;
andposition: fixed;
. Fixing this may involve tracking more than just whether or not the element is fixed when the snapshot is taken; I haven't spent enough time with that failing test case.