tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Introduce `:user-valid` & `:user-invalid` variants

Open MartijnCuppens opened this issue 2 years ago • 7 comments

See

  • https://developer.mozilla.org/en-US/docs/Web/CSS/:user-valid
  • https://developer.mozilla.org/en-US/docs/Web/CSS/:user-invalid

Just landed in Chrome, Firefox & Safari:

  • https://caniuse.com/mdn-css_selectors_user-valid
  • https://caniuse.com/mdn-css_selectors_user-invalid

MartijnCuppens avatar Nov 07 '23 08:11 MartijnCuppens

It looks like the pseudo elements are not yet added to https://github.com/cssnano/cssnano/blob/master/packages/postcss-merge-rules/src/lib/ensureCompatibility.js, because they are part of the Selectors Level 4 spec. Should I unmerge the rules in the test for now or should we wait for this feature to land until support is added in postcss-merge-rules?

MartijnCuppens avatar Nov 07 '23 10:11 MartijnCuppens

Hey!

You might have noticed that I forced pushed to this branch. The reason is because the PR now uses next as the base branch which is our working branch for Tailwind CSS v4. In other words, the feature you implemented here is now written in the new codebase.

The code is ported as-is, so no API changes of your feature happened while moving it to the new codebase.

I also made sure to add you as a co-author because you still deserve all the credit 💪

RobinMalfait avatar Apr 17 '24 21:04 RobinMalfait

Hi @RobinMalfait! Is it possible to have it in v3, or it will only be available in v4?

Ionys320 avatar May 16 '24 14:05 Ionys320

Any updates / timeline on this? Looking forward to these inputs!

Kashi-Datum avatar May 23 '24 19:05 Kashi-Datum

Hi @RobinMalfait! Is it possible to have it in v3, or it will only be available in v4?

Yes, you can use arbitrary properties: [&:user-invalid]:

jstoparczyk avatar Jun 16 '24 16:06 jstoparczyk