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

[idea] auto-inferred variants based on standard pseudo classes #3970

Closed
kctdfh opened this issue Apr 3, 2021 · 5 comments
Closed

[idea] auto-inferred variants based on standard pseudo classes #3970

kctdfh opened this issue Apr 3, 2021 · 5 comments
Labels

Comments

@kctdfh
Copy link

kctdfh commented Apr 3, 2021

There are some nice plugins out there for non existent interaction variants such as group-hover-within but it'd be great for JIT to support every standard pseudo class as variant.

Things like required, optional, and read-only are very useful for designing form elements but currently require a plugin.

Would be nice to at least have a subset of these standard pseudo classes be recognized as variants by JIT so that we can simply write required:ring-red-600 and have it just work.

@adamwathan adamwathan transferred this issue from tailwindlabs/tailwindcss-jit Apr 5, 2021
@adamwathan adamwathan added the jit label Apr 5, 2021
@adamwathan
Copy link
Member

Yeah I think this would be good to add — one thing that would help us do it faster is if someone wants to provide a full list of what's missing, and think through the order they should be listed in to have the most intuitive override behavior.

For example, should required:border-red-500 override focus:border-red-500 if a required element is focused?

@kctdfh
Copy link
Author

kctdfh commented May 17, 2021

Great! I'd be open to creating a draft for this by the end of the week. The community can then refine it based on their experience using the pseudo classes. Should I start a discussion thread when it's ready or is an issue better suited? Or should I just post it on this thread?

@adamwathan
Copy link
Member

Let's keep it to this thread or in a PR if you wanted to take it that far 👍🏻

@Triloworld
Copy link

Yeah I think this would be good to add — one thing that would help us do it faster is if someone wants to provide a full list of what's missing, and think through the order they should be listed in to have the most intuitive override behavior.

For example, should required:border-red-500 override focus:border-red-500 if a required element is focused?

Maybe there is simple method to organize pseudo-classes in more natural way. I will call it as "context related" and "user focus" to align with browser.

Website:

  1. Static (before:border-red-500)
  2. Dynamic state (client:before:border-red-600, theme:before:border-red-500, before:border-red-500)
    User:
  3. Website one time change state because of user action (open:loading:before:border-red-600 required:before:border-red-500)
  4. User see loader or something visible in time after doing action (loading:before:border-red-800 open:before:border-red-700 required:before:border-red-600 before:border-red-500)
  5. User action right in time and one place focused (focus:border-red-900 ...)

This need to be investigate and write to some documentation when JIT can introduce all sort of pseudo thinks

@adamwathan
Copy link
Member

PR'd and merged this stuff earlier this week 👍🏻

#4482

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

No branches or pull requests

3 participants