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

[Slider][base][material][joy] Fix not draggable on the edge when disableSwap={true} #35998

Merged
merged 20 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/mui-base/src/SliderUnstyled/SliderUnstyled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled<
...props,
marks: marksProp,
disabled,
disableSwap,
isRtl,
defaultValue,
max,
Expand Down Expand Up @@ -278,7 +279,8 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled<
})}
style={{
...style,
pointerEvents: disableSwap && active !== index ? 'none' : undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this logic not inside getThumbProps() of useSlider? It seems that we have to fix 3 different places at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// So the non active thumb doesn't show its label on hover.
pointerEvents: active !== -1 && active !== index ? 'none' : undefined,
...thumbProps.style,
ZeeshanTamboli marked this conversation as resolved.
Show resolved Hide resolved
}}
>
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-joy/src/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ const Slider = React.forwardRef(function Slider(inProps, ref) {
classes: classesProp,
disabled,
defaultValue,
disableSwap,
isRtl,
max,
min,
Expand Down Expand Up @@ -613,7 +614,8 @@ const Slider = React.forwardRef(function Slider(inProps, ref) {
})}
style={{
...style,
pointerEvents: disableSwap && active !== index ? 'none' : undefined,
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
// So the non active thumb doesn't show its label on hover.
pointerEvents: active !== -1 && active !== index ? 'none' : undefined,
...thumbProps.style,
}}
>
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ const Slider = React.forwardRef(function Slider(inputProps, ref) {
})}
style={{
...style,
pointerEvents: disableSwap && active !== index ? 'none' : undefined,
// So the non active thumb doesn't show its label on hover.
pointerEvents: active !== -1 && active !== index ? 'none' : undefined,
...thumbProps.style,
}}
>
Expand Down