-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[SliderUnstyled] Fix dragging on disabled sliders #31882
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my perspective, this is the whole fix:
material-ui/packages/mui-material/src/Slider/Slider.js
Lines 101 to 105 in bbdf508
[`&.${sliderClasses.disabled}`]: { | |
pointerEvents: 'none', | |
cursor: 'default', | |
color: theme.palette.grey[400], | |
}, |
updating the demo. The cursor/color is still wrong on this PR, proof: https://codesandbox.io/s/unstyledslider-material-demo-forked-sq5hq6
I will add this in addition, but I still think we need to disable the interaction on the component itself. We already support the prop, so why not handle it in the unstyled component? We partially handle some of the interaction based on the Edited: @michaldudak could you update the unstyled demos with the codesnippet above in #31850 to avoid conflicts? |
Sure! As the interaction is blocked in the event handlers, we don't need |
Good point, yes, we shouldn't need it. |
Actually, it prevents the hover styles from kicking in, so I decided to leave it after all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these cases where tests take 5x more effort than the implementation :)
Good job!
Fixes #31851