Skip to content
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

Fix regression in pseudo-element handling #117

Merged
merged 2 commits into from
May 3, 2024

Conversation

m-akinc
Copy link
Contributor

@m-akinc m-akinc commented May 2, 2024

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.

@ghengeveld ghengeveld added patch Increment the patch version when merged skip-release Preserve the current version when merged labels May 2, 2024
@ghengeveld
Copy link
Member

ghengeveld commented May 3, 2024

Awesome, looks good now 👍

Maybe we need to address that useEffect issue, but it's beyond the scope of this change.

@ghengeveld ghengeveld merged commit 59cb994 into chromaui:main May 3, 2024
3 checks passed
Copy link

github-actions bot commented May 6, 2024

🚀 PR was released in v3.1.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged released This issue/pull request has been released. skip-release Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants