Re: [csswg-drafts] [css-contain] :root/body viewport propagation and containment (#5913)

A new proposal:

What if we propagate properties from body to viewport as if no container queries match, but the computed style on body will be evaluated as for any other element.

So in the case below the computed overflow on body will be 'visible', but the value propagated to the viewport will be 'scroll':

```html
<style>
  html {
    width: 500px;
    contain: layout size;
  }
  body {
    overflow: scroll;
  }
  @container (min-width: 400px) {
    body {
      overflow: visible;
    }
  }
  @container (max-width: 400px) {
    body {
      overflow: hidden;
    }
  }
</style>
```

That means we need to store the propagated properties separately. Implementation-wise for Blink, it would probably be done by computing a separate set of computed values for body if the the body computed style depends on container queries for any of the propagated properties.

If the author refrains from adding overflow, writing-mode, etc inside @container rules for body, there should be no extra cost.


-- 
GitHub Notification of comment by lilles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5913#issuecomment-814726342 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 7 April 2021 08:43:28 UTC