This rule reports a variant stack that tests a shadow host through the elements
around it, such as host:in-[.page]: or host:group-hover:. A selector in a shadow
tree cannot read those elements, so the rule never matches.
Reported
style.css("host:in-[.page]:block");unmatched-host-selector: `:where(:is(.page)) :host` cannot match the shadow host; pass the state down with a custom propertyFixed
style.css("[:host(.page)]:block");How to fix
- Add a class or an attribute to the host, and test it inside
:host(), as in the example. - Set a custom property on the outer element, and read it on the host with
--if(). Custom properties inherit into a shadow tree.
Rule settings
| Preset | Severity |
|---|---|
recommended | warn |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.