Open Bug 2015413 Opened 3 days ago Updated 2 days ago

Show tooltip for variables in container style query (style())

Categories

(DevTools :: Inspector: Rules, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

References

(Blocks 1 open bug)

Details

CSS variables / custom properties can be referenced in the style() property of a @container query (see https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_size_and_style_queries#container_style_queries)
We can probably show the same tooltip that we have in property values
Note that we should make sure that the value we show is the one for the element the parent selector applies to, not the currently selected element.
For example, in :

<meta charset="utf8" />
<style>
  :root {
    --theme: red;
  }

  h1 {
    --theme: blue;
  }

  @container style(--theme: red) {
    h1 {
      color: var(--theme);  
    }
  }
</style>
<h1>Hello</h1>

in @container style(--theme: red) the tooltip should (obviously) indicate red, which is the value on the parent of h1 (and actually the root element), whereas in the color: var(--theme), the tooltip will say blue

FWIW Chrome doesn't have a tooltip for this, but I think it would be nice to have to reduce confusion, especially when the condition has multiple parts

Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.