When improving support for :not(), I had made a change that accidentally prevented rewriting rules that had pseudo-elements with pseudo-states applied, e.g. ::part(foo):active or ::-webkit-scrollbar-thumb:hover. Though we want to avoid generating selectors that apply classes to these pseudo-elements (it is invalid CSS), we still want to generate the selectors involving the .pseudo-<state>-all classes. Since we do not append those classes to the pseudo-elements (e.g. .pseudo-active-all ::part(foo)), they are valid CSS.
I have updated the tests to ensure we generate the .pseudo-<state>-all-based selectors, but not the .pseudo-<state>-based ones.
Even after this fix, I noticed that the ShadowRootWithPart story was not consistently being rendered properly. It turned out that the stylesheet rewrite was happening before the React.useEffect hook was inserting the styles into the element. By switching to including the styles by importing, the timing issue is resolved.
When improving support for
:not()
, I had made a change that accidentally prevented rewriting rules that had pseudo-elements with pseudo-states applied, e.g.::part(foo):active
or::-webkit-scrollbar-thumb:hover
. Though we want to avoid generating selectors that apply classes to these pseudo-elements (it is invalid CSS), we still want to generate the selectors involving the.pseudo-<state>-all
classes. Since we do not append those classes to the pseudo-elements (e.g..pseudo-active-all ::part(foo)
), they are valid CSS.I have updated the tests to ensure we generate the
.pseudo-<state>-all
-based selectors, but not the.pseudo-<state>
-based ones.Even after this fix, I noticed that the ShadowRootWithPart story was not consistently being rendered properly. It turned out that the stylesheet rewrite was happening before the
React.useEffect
hook was inserting the styles into the element. By switching to including the styles by importing, the timing issue is resolved.