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

[bug]: Disabled Slider is Not Styled or Supported by Label Properly #6323

Open
2 tasks done
nbibler opened this issue Jan 10, 2025 · 0 comments
Open
2 tasks done

[bug]: Disabled Slider is Not Styled or Supported by Label Properly #6323

nbibler opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@nbibler
Copy link

nbibler commented Jan 10, 2025

Describe the bug

The Slider Component carries incorrect TailwindCSS classes to support the @radix-ui/react-slider implementation, because the implementation (correctly) doesn't utilize a disabled attribute (those are only available to INPUTs, not SPANs, as implemented).

The Slider generator currently uses disabled: TailwindoCSS classes which fail to match because the disabled attribute isn't utilized. Rather, it should be using aria-disabled: classes on the SliderPrimitive.Root, as the root element is flagged with aria-disabled="true". If the Slider handle is intended to be targeted (disabled:pointer-events-none), the SliderPrimitive.Thumb should instead carry the data-[disabled]:pointer-events-none TailwindCSS class, as that element uses data-disabled.

Additionally, the Label Component fails to recognize and visually represent the disabled state of Slider, because of the lack of disabled attribute. I don't have a great suggestion here. Ideally, the Label would be extended to included a peer-aria-disabled, but that becomes based on DOM positioning and the Slider carrying a peer class which cannot be assumed. 🫤

Affected component/components

Slider

How to reproduce

  1. Generate a new Slider component
  2. Add the Slider component to a page
  3. Disable the Slider component
  4. Note there is no visual differentiation between disabled or enabled, the cursor doesn't change, and pointer events still trigger.

Codesandbox/StackBlitz link

No response

Logs

N/A

System Info

N/A

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@nbibler nbibler added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant