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

peer-focus:peer-valid:* generates wrong output #4726

Closed
kripod opened this issue Jun 20, 2021 · 4 comments · Fixed by #4757
Closed

peer-focus:peer-valid:* generates wrong output #4726

kripod opened this issue Jun 20, 2021 · 4 comments · Fixed by #4757

Comments

@kripod
Copy link

kripod commented Jun 20, 2021

What version of Tailwind CSS are you using?

v2.2.2

What build tool (or framework if it abstracts the build tool) are you using?

Next.js 11.0.0

What version of Node.js are you using?

v14.16.1

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction repository

https://github.com/kripod/next-starter-strict/blob/main/src/components/inputs/Input.tsx

Describe your issue

While trying to apply peer-focus:peer-valid:border-blue-500 to avoid a precedence clash with peer-invalid:border-red-500, it turns out that the former generates the following input, which is invalid:

.peer:focus:valid ~  ~ .peer-focus\:peer-valid\:border-blue-500 {
  --tw-border-opacity: 1;
  border-color: rgba(59, 130, 246, var(--tw-border-opacity));
}

Tailwind should generate something like below instead, making peer-* utilities composable:

.peer:focus:valid ~ .peer-focus\:peer-valid\:border-blue-500 {
  --tw-border-opacity: 1;
  border-color: rgba(59, 130, 246, var(--tw-border-opacity));
}
@adamwathan
Copy link
Member

Ah good catch! Will try and take a look at this this week, PR welcome if anyone wants to try before I (or @RobinMalfait 👀) have time.

@RobinMalfait
Copy link
Member

RobinMalfait commented Jun 21, 2021

Thanks for the bug report, but I think you might have a caching issue. This has already been fixed in v2.2.2. When I clone the repo I see this as a result:

image

Some steps you can try to fix this:

  • Remove the .next folder & restart the dev project
  • rm -rf node_modules && npm install

Can you verify that this works for you?

@kripod
Copy link
Author

kripod commented Jun 21, 2021

@RobinMalfait I did all the steps you’ve suggested and it turns out that the issue only persists in development (next dev) – production builds are working fine (next build && next start).

@RobinMalfait
Copy link
Member

@kripod thank you for testing things out. I can reproduce this issue in tests now, will report back here once I have a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants