Re: [csswg-drafts] [css-scoping-1] Dynamic changes of state and attributes referenced by :host-context rules are pretty hard to handle efficiently. (#1914)

I agree with @rniwa on this specific matter -- `:host-context([dir=rtl])` means "any ancestor with dir == 'rtl' above, even if that's not the effective directionality[1]" (which is why `:dir` exists).  I get that it's better than nothing, but it's not bulletproof (and you can use a CSS var instead).

re: theming -- i think recent `@media (prefers-color-scheme: light/dark) {...}` is fine to embed inside of a component such that it adapts to system UI theme.  I think you're able to specify your own themes as well, but it generally reduces the generic nature of web components the more you make them aware of their housing/surroundings.  it's better to expose "parts" which can be styled externally, IMO.

[1] it'd be easy for a closer [dir="ltr"] ancestor to be ignored, as would be a `direction:` rule in CSS.

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

Received on Tuesday, 26 November 2019 20:32:02 UTC