-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(style-compiler): enable :root & :host-context() for native-shadow-only CSS #4833
feat(style-compiler): enable :root & :host-context() for native-shadow-only CSS #4833
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me! Thanks for jumping on it so fast. (Impressive! ๐คฉ)
One small issue I notice here is that, if this is a scoped CSS file (foo.scoped.css
) then the selectors are compiled into:
:root.foo {}
:host-context(.foo) {}
These are both valid selectors (TIL) but they don't make much sense for scoped styes. For the :root
, you cannot add a class to a shadow root, nor does LWC add a class to the <html>
which is where it would need to be at the top level. As for :host-context()
, LWC also doesn't add the .foo
selector to an ancestor of the host.
I would just have these throw an error if we are in scoped mode. You can test it in the fixtures by adding "scoped": true
to the config.json
.
Thanks again!!
Thanks for the review @nolanlawson ๐ I'll work on the scoped case tomorrow. |
@nolanlawson I handled the scoped case in the last commit. I kept it simple, but maybe it'd be better to have different error messages for synthetic & unscoped vs native & scoped? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! ๐
/nucleus test |
Details
Closes #4832
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
If
disableSyntheticShadowSupport: true
is specified, using :root and :host-context() will no longer result in errors.GUS work item