-
Notifications
You must be signed in to change notification settings - Fork 32
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
Avoid invalid ::part
selector
#113
Conversation
@ghengeveld Assuming this gets merged, I have at least one other change to submit afterwards. |
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.
Nice work!
Do you want to release that other change along with this one? In that case this PR should be labeled with |
I assumed it would be easier to just release once, which is why I gave that heads-up. I don't have permissions to modify the labels on the PR, so I guess you will need to add the label (unless you want to give contributors that permission). |
🚀 PR was released in |
It is not valid CSS to add a class selector to the
::part()
pseudo-element, so rewriting a selector like::part(foo):hover
to::part(foo).pseudo-hover
is a problem.::-webkit-scrollbar-thumb
and::-webkit-slider-thumb
have the same limitation, and there was already logic to avoid generating modified selectors that included those. However, that logic was overly restrictive, preventing valid rewrites likediv:hover::-webkit-scrollbar-thumb
->div.pseudo-hover::webkit-scrollbar-thumb
.This change includes:
::part()
followed by a class selectorelt:hover::part(foo)
andelt:hover::-webkit-scrollbar-thumb
pseudo-*-all
classes get added to shadow hosts, even if their shadow DOM didn't have stylesheets that got rewritten. This is necessary to support::part()
-based styling, since those styles are (usually) in the light DOM.pseudo-*-all
classes get cleared from shadow hosts when switching Storybook stories::part()
support