[css-sizing-4] [css-contain] Proposal to add contain-intrinsic-size: auto;
to fix shifting scrollbar problem.
#5815
Labels
contain-intrinsic-size: auto;
to fix shifting scrollbar problem.
#5815
The allowed values for the
contain-intrinsic-*
properties are eithernone
or a<length>
, with an initial value ofnone
.When a
contain-intrinsic-size: none;
is combined withcontent-visibility: auto;
you get the already documented side effect where the scrollbar will shift:To cater for the 2nd problem @slightlyoff has created a little script (using
IntersectionObserver
andResizeObserver
) which automatically injectscontain-intrinsic-size
on elements that get rendered. As those elements then slide out of the viewport and eventually get hidden — due tocontent-visibility: auto;
doing its thing — the symptoms of that 2nd problem no longer appear — due tocontain-intrinsic-size
which got injected.This made me wonder:
The way I see it, a value of
auto
would by default behave likenone
does, but once an element has been rendered and its dimensions are known, those dimensions would then be stored (internally) for further use. That way once it slides out of view again and gets hidden, there's no issue with the scrollbar.With this addition I'd keep the initial value of
none
for thecontain-intrinsic-*
properties in place, as choosing forauto
comes at an expense (I guess). Therefore it should be opt-in, as an explicit choice by the developer.Would this be something worth pursuing?
The text was updated successfully, but these errors were encountered: