Hi,
According to the css-contain spec [1], layout containment establishes a
containing block for absolute and fixed positioned descendants.
We have a bug report about that
https://crbug.com/85212 that I decided
to fix last week as it was quite simple and straight forward:
https://chromium-review.googlesource.com/1059557
The problem is that the change broke YouTube on mobile, as it uses
"contain: layout" and positioned elements under it, which are now
positioned regarding to a different element (the one with "contain:
layout").
As we're about to do the branch for M68, the patch was reverted but we
need to decide the plan about what to do for M69.
This part of the spec is needed in order to be able to implement the
optimizations defined by css-contain, which states the following about
layout containment:
"This ensures that the containing element is totally opaque
for layout purposes; nothing outside can affect its internal layout,
and vice versa."
The text related to absolutely and fixed positioned descendants in
layout containment comes from the following discussion on the CSS WG:
https://github.com/w3c/csswg-drafts/issues/404
There you can find a clear example for this issue.
If the spec part is not under discussion, then some sites (like YouTube)
would need to be modified.
Some of the possible changes to be done would be:
* For the case of absolutely positioned elements, it'd be a matter of
adding "position: relative" to the "contain: layout" elements and
updating the offsets in the descendants. That would make things work
before and after the patch.
* For fixed positioned elements, you'd need to apply a transform to
those elements apart from updating the offsets too, as "position:
relative" won't be enough.
* Of course another option for both cases is to simply avoid "contain:
layout" completely on those elements.
So the question now is what to do next?
1) Reland the patch at the beginning of M69 cycle and ping site owners
to get things fixed on their end?
2) Add a use counter to collect data about how many cases are affected
by this (maybe land the use counter in M68 too).
If this is small go to 1). But if it's too big contact site owners to
fix things and try to get it down enough to go to 1).
3) Any other idea?
I don't really know what should be the next steps, so feedback is really
appreciated.
Thanks,
Rego
[1]
https://drafts.csswg.org/css-contain/#containment-layout