Skip to content

Being able to target elements with data attributes #380

Answered by nmn
Sparkmasterflex asked this question in Q&A
Discussion options

You must be logged in to vote

This pattern isn't officially supported, but you can use :is([data-disabled]) where you would normally use :hover to get around this problem for now.

We don't recommend this pattern in general and prefer applying styles conditionally instead. Using attribute selectors leads to a duplicate CSS rule where an existing className would've sufficed.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Sparkmasterflex
Comment options

Answer selected by Sparkmasterflex
Comment options

You must be logged in to vote
1 reply
@nmn
Comment options

nmn May 8, 2024
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
3 participants
Converted from issue

This discussion was converted from issue #378 on January 26, 2024 05:51.