Re: [csswg-drafts] [css-scroll-anchoring] Should not apply anchoring adjustments from scroll event handlers (#4239)

> Is this proposal specifically limited to scroll handlers that force synchronous layout (e.g. reading back offsetTop or scrollTop after changing the DOM) before yielding?

Yes, basically.

> Some historical context: the sticky header feedback loops that we originally encountered didn't necessarily force synchronous layout. They would just touch DOM and yield. Then the lifecycle update performs the scroll anchoring adjustment, but we are no longer "inside" the listener.
> We thought about a more general solution, in which the adjustment would be suppressed if the movement of the anchor node occurred "because of" a scroll event listener which finished in the past. We concluded that tracking causality in this manner was too difficult.

I see, that's fair.

> The cases that motivated http://bit.ly/sanaclap ("suppression triggers" in the spec) would not have been solved by merely suppressing adjustments during sync layouts inside scroll listeners.
>
> But it might make sense to do this, if it fixes additional cases that are not addressed by the suppression triggers.

It does, see above. But you're right we probably  cannot remove the existing triggers.

> On the other hand it is weird for the behavior to be different because the scroll listener did a layout-forcing readback before yielding. Usually a readback is a nop.

Well,  it is when scroll anchoring _isn't_ suppressed when reading back also changes scroll positions, right? At least that's my mental model of it.

-- 
GitHub Notification of comment by emilio
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4239#issuecomment-535629369 using your GitHub account

Received on Thursday, 26 September 2019 18:27:41 UTC