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

feat(core)!: make select pseudo elements not to be moved around #2190

Merged
merged 5 commits into from Feb 22, 2023

Conversation

chu121su12
Copy link
Collaborator

Alternative to #2174

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e07625c
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63f567127d03dd000874c052
😎 Deploy Preview https://deploy-preview-2190--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@sibbng sibbng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. But it turns out at the moment that no matter whether movePseudoElementsEnd is used or not pseudo-elements are always at the end of the selector. This is a regression that happened at some point. Unfortunately, current test is only testing movePseudoElementsEnd function. I did that to be sure pseudo-elements properly moved even in extreme cases.

First of all, we have to figure out what causing all pseudo-elements to be moved end of the selector.

Given that input:

<input type="file" class="dark:hover:file:bg-red-600">
<input type="file" class="dark:file:hover:bg-red-600">

it should generate these selectors:

.dark .dark\:file\:hover\:bg-red-600:hover::file-selector-button{...}
.dark .dark\:file\:hover\:bg-red-600::file-selector-button:hover{...}

but it generated this:

.dark .dark\:file\:hover\:bg-red-600:hover::file-selector-button{...}
.dark .dark\:file\:hover\:bg-red-600:hover::file-selector-button{...}

Playgrounds
Deploy Preview Playground - ❌
Tailwind Playground - ✔

I tested the state of the repository before #987. It applies :hover and ::file-selector-button in a different order as expected, but in the wrong order which later is fixed by #987. Generating pseudo-elements at the end of the selector is not normal even if we remove movePseudoElementsEnd. We have to address what caused this problem.

@sibbng
Copy link
Member

sibbng commented Feb 13, 2023

@chu121su12 I ran git bisect against #987 and it seems regression is caused by #1127. Some of these changes are reverted in #1162 but the source of the problem is coming from what's left. Probably around here:

https://github.com/unocss/unocss/pull/1127/files#diff-72ab94343d47e2266a978d9981390f8bb9a6546dbdf17d0727b6a6687a769ca4R123-R137

@sibbng
Copy link
Member

sibbng commented Feb 13, 2023

Thanks for your work @chu121su12, I fixed the issue and ditched movePseudoElementsEnd. I always wanted to fix this on the generator level instead of later patching with regex. Your work on #1127 led us here 🙏

@antfu antfu added this to the Next milestone Feb 22, 2023
@antfu antfu merged commit c0eedbf into unocss:main Feb 22, 2023
@chu121su12 chu121su12 deleted the fix-pseudo-2 branch February 23, 2023 00:21
@sibbng sibbng mentioned this pull request Mar 20, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants