[csswg-drafts] [css-contain-3] What happens when the queried dimension is not contained by the nearest container? (#6303)

mirisuzanne has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-contain-3] What happens when the queried dimension is not contained by the nearest container? ==
When we have nested containers, with different contained axes, do we only query the nearest container -- or do we query the nearest container _which has the proper containment_? For example:

```html
<style>
  @container (block-size >= 100px) {
    p { background: green; }
  }
</style>

<html style="contain: size layout style; block-size: 200px;">
  <main style="contain: inline-size layout style">
    <p>query</p>
  </main>
</html>
```

1. If we query the nearest ancestor that is a container (`main`), the match is `false` because the block-size is not contained, and cannot be queried
2. If we look for the nearest ancestor _with block containment_  (`html`), the match is `true` because the block size matches the given condition

I _think_ in this case we want option 2, and should only consider an ancestor to be "a container" if it meets all the required containment criteria. But maybe I'm missing something?

@andruud @lilles - do you have thoughts on this?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6303 using your GitHub account


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

Received on Friday, 21 May 2021 23:07:35 UTC