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

Tailwind Plugin Broken in V4 #7661

Open
mhornbacher opened this issue Jan 23, 2025 · 2 comments · May be fixed by #7669
Open

Tailwind Plugin Broken in V4 #7661

mhornbacher opened this issue Jan 23, 2025 · 2 comments · May be fixed by #7669

Comments

@mhornbacher
Copy link

Provide a general summary of the issue here

It seems that the :merge selector is no longer supported in V4 and is not included in the v4 docs.

tailwindlabs/tailwindcss#15617

🤔 Expected Behavior?

The plugin should not break the application when using peer selectors

😯 Current Behavior

The following error is thrown by Tailwind v4

Parsing css source code failed
  530 |   }
  531 |   .peer-disabled\:text-purple-500 {
> 532 |     :merge(.peer):where([data-rac])[data-disabled] ~ & {
      |             ^
  533 |       color: var(--color-purple-500);
  534 |     }
  535 |     :merge(.peer):where(:not([data-rac])):disabled ~ & {

'merge' is not recognized as a valid pseudo-class. Did you mean '::merge' (pseudo-element) or is this a typo? at [project]/src/app/globals.css:531:12

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

https://github.com/mhornbacher/tailwind-repro

Version

tailwindcss-react-aria-components 1.2.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

Kiddom

🕷 Tracking Issue

No response

@lensbart
Copy link

Might be related to #6127

@deebov
Copy link
Contributor

deebov commented Jan 24, 2025

Hey @mhornbacher, we had the same issue and a very quick workaround for us was to copy the index.js of the plugin and import it locally.

We only has to comment out the conflicting part in the plugin:

matchVariant(
'group',
(_, {modifier}) =>
modifier
? mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.group\\/${modifier})${s.slice(1)} &`))
: mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.group)${s.slice(1)} &`)),
{values: {[variantName]: variantName}}
);
matchVariant(
'peer',
(_, {modifier}) =>
modifier
? mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.peer\\/${modifier})${s.slice(1)} ~ &`))
: mapSelector(selectors, selector => wrapSelector(selector, s => `:merge(.peer)${s.slice(1)} ~ &`)),
{values: {[variantName]: variantName}}
);

Can't say if this workaround works as effectively as the React Aria team initially intended, because these lines were responsible for adding such selectors to ensure only RAC components are targeted:

  ':merge(.group):where([data-rac])[data-disabled] &',
  ':merge(.group):where(:not([data-rac])):disabled &'

But it did fix our issues.

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