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

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-scroll-anchoring] Should not apply anchoring adjustments from scroll event handlers ==
Most of the most annoying scroll anchoring issues I've fixed on Firefox over the last few months are due to the adjustments accidentally triggered from scroll event listeners. Some examples off the top of my head:

 * https://bugzilla.mozilla.org/show_bug.cgi?id=1568778
 * https://bugzilla.mozilla.org/show_bug.cgi?id=1543599

These adjustments trigger other scroll event listeners, which in turn generally either confuse the page or let the page burn a lot of CPU for no good reason.

The spec has the concept of [suppression triggers](https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers) to prevent most of these. Those are mostly heuristics, and are not equally implemented across browser.

In https://bugzilla.mozilla.org/attachment.cgi?id=9087497 I came up with a reduced test-case for something that we saw in the wild, and for which we _don't_ want to suppress the adjustment in the more general case of it not being triggered by a scroll event listener. The test-case locks up scrolling in Firefox and Chrome once you scroll to the bottom.

Other than not doing scroll anchoring adjustments every time anyone updates layout (which may or may not be implementable), the other reasonable solution I can think of is to not adjust scroll positions of an element if we're processing an scroll event listener for that target.

That's what I'm going to implement in https://bugzilla.mozilla.org/show_bug.cgi?id=1561450, I think, and I'm going to investigate removing other suppression triggers which should be unnecessary after that change as followup work.

cc @skobes @eqrion @dholbert 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4239 using your GitHub account

Received on Friday, 23 August 2019 12:19:07 UTC