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?

Based on https://phabricator.services.mozilla.com/D43233 it sounds like yes.  Blink could also implement this fairly easily.

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.

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.

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.

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

Received on Monday, 16 September 2019 15:59:32 UTC