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

refactor: limit attribute rules to input and select elements #159

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sabbaticaldev
Copy link

Currently the rules for styling the inputs are too broad and may conflict with web components that use props named type or mutiple. This PR address this issue by using :where to select only inputs without change the specificity.

Copy link

vercel bot commented Jun 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-forms ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 7:40pm

@thecrypticace
Copy link
Contributor

Wrapping an existing portion of a selector in :where(…) will change its specificity but I've fixed them up so that doesn't happen. I think the likelihood of things breaking is probably zero but I think I'd rather be on the safe side here.

@thecrypticace thecrypticace requested a review from adamwathan June 14, 2024 19:05
@adamwathan
Copy link
Member

Honestly I think we should stick with the change from the original commit, where the element selector is bare but the attribute selector is wrapped in :where:

input:where([type=date])

It does reduce the specificity from 0,1,0 to 0,0,1 but I'll take the blame if that breaks anything 🙃 I would've chosen a 0,0,1 selector originally if it were possible anyways.

@thecrypticace
Copy link
Contributor

And this is why I tagged you — I thought there was a chance you might want to.

`input:where([type='checkbox']):checked:hover`,
`input:where([type='checkbox']):checked:focus`,
`input:where([type='radio']):checked:hover`,
`input:where([type='radio']):checked:focus`,
Copy link
Contributor

Choose a reason for hiding this comment

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

@adamwathan Should we put these pseudo classes inside :where(…)? I'm not sure.

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 this pull request may close these issues.

3 participants