WICG / layout-instability

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

ignore inline-direction shift in/out of view #98

Closed skobes-chromium closed 3 years ago

skobes-chromium commented 3 years ago

On crbug.com/1183938 it was determined that some carousel implementations report a layout shift when reordering their contents. The shift in question is not really user-visible and the final state of the shifted element ("A" in the diagram below) is fully outside the overflow clip:

https://docs.google.com/drawings/d/1uYBSimpIX89EIbprLlh_UdoeqM0WBNGOFBMhJEy1K8Y/edit

As I mentioned on https://github.com/WICG/layout-instability/issues/62#issuecomment-670308950 I do not think we should add a general exclusion for elements that shift into or out of the viewport, because this would have the perverse effect of allowing real shifts where the shift distance is larger than the viewport dimension.

But carousels are almost always horizontal so we can build a more targeted fix: allow shifts into or out of the viewport in the inline direction (horizontal for horizontal writing modes, or vertical for vertical writing modes).