rtCamp / wp-cls-terminator

Remove CLS from Block Editor Embeds
1 stars 2 forks source link

Utilize container queries instead of media queries #7

Open westonruter opened 1 year ago

westonruter commented 1 year ago

Now that container queries are generally available (caniuse), I suggest that the following logic be updated to use them instead of media queries:

https://github.com/rtCamp/wp-cls-terminator/blob/42b682451985c629c262f3029b5a2c32ffd44cba/includes/class-cls-terminator.php#L49-L60

The key reason here is that the embed may be rendered inside of a column which is narrower than the entire window, meaning that the media query won't produce the right result.

A feature query may also be utilized (e.g. @supports (contain: inline-size) { /*...*/ }) where relevant.

westonruter commented 1 year ago

cf. https://github.com/GoogleChromeLabs/layout-shift-terminator/issues/8