Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Being able to target elements with data attributes #378

Closed
Sparkmasterflex opened this issue Jan 26, 2024 · 1 comment
Closed

Being able to target elements with data attributes #378

Sparkmasterflex opened this issue Jan 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Sparkmasterflex
Copy link

Sparkmasterflex commented Jan 26, 2024

Describe the feature request

I'm working on a project where we're combining StyleX and Radix-UI and their Select component has a disabled state for options. It puts this value as a aria-disabled and a data-disabled attributes and then style with css off of this:

Screenshot 2024-01-25 at 3 14 14 PM
.SelectItem[data-disabled] {
  color: var(--mauve-8);
  pointer-events: none;
}

I think because it's not an actual <option> that they're rendering, it wouldn't be valid for them to use the actual disabled attribute that is put on form fields and such.

I've been looking through docs and code for StyleX and I can't find any way to do this

@Sparkmasterflex Sparkmasterflex added the enhancement New feature or request label Jan 26, 2024
@nmn
Copy link
Contributor

nmn commented Jan 26, 2024

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.

@facebook facebook locked and limited conversation to collaborators Jan 26, 2024
@nmn nmn converted this issue into discussion #380 Jan 26, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants