css-toggle icon indicating copy to clipboard operation
css-toggle copied to clipboard

definition of toggle scope should mention style containment

Open dbaron opened this issue 3 years ago • 3 comments

The definition of toggle scope should probably mention that toggle scope doesn't cross style containment boundaries. (At least, I think this is the right thing to do.)

(Also, It would be nice if there were an id to link to for "scope".)

dbaron avatar Aug 16 '22 19:08 dbaron

I started to implement this, and then realized there are some interesting cases.

In particular, what does the following do:

<style>
#outer { toggle-root: t 1 at 1; }
#inner { background: blue; }
#inner:toggle(t) {
  contain: style;
  background: purple;
}
</style>

<div id="outer">
  <div id="inner"></div>
</div>

Is the <div id=inner> purple or blue?

Maybe this suggests that toggle scope actually shouldn't be affected by style containment?

dbaron avatar Aug 31 '22 12:08 dbaron

The code I was working on is at https://crrev.com/c/3866304 .

dbaron avatar Aug 31 '22 12:08 dbaron

Oh, and maybe an even more convincing reason we don't want to depend on style containment is that toggle-visibility implies contain:style... which means an element with toggle-visibility that is currently hidden... can no longer see the toggle that controls it.

(Although that would still allow depending on style containment where the element itself can see toggles outside of it, but its descendants can't.)

dbaron avatar Aug 31 '22 20:08 dbaron