WICG / layout-instability

A proposal for a Layout Instability specification
https://wicg.github.io/layout-instability/
Other
158 stars 27 forks source link

Alternative to DCLS that better represents user experience of jank #7

Open wildlyinaccurate opened 5 years ago

wildlyinaccurate commented 5 years ago

I'm not convinced that DCLS is representative of how users perceive layout instability. DCLS would weight several layout shifts in a short space of time as separate "janks", however people typically perceive delays of <100ms as near-instantaneous.

An alternative might be to group layout shifts into time buckets, and sum the biggest layout shift for each bucket. I believe this approach would produce a score that more closely represents how a user experienced the janks.

I've made a contrived example here that demonstrates what I'm talking about. This page makes several small janks ~10ms after one another, and then one bigger jank a second later. DCLS takes all of those small janks into account, but I believe most people will perceive it as a single jank. https://wildlyinaccurate.com/webdump/dcls.html

skobes-chromium commented 5 years ago

This is an interesting idea to explore as we iterate on the metric. I agree that the amount of time between consecutive layout shifts has a correspondence to the perceived severity of layout instability, which is not reflected in the current definition. That said, I think we should be cautious about accumulating too much heuristic-oriented complexity in pursuit of a perfect alignment with user perception. But incorporating some consideration of "elapsed time since previous shift" seems reasonable.