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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Slider] Remove not needed mark in range Sliders #31960
Comments
Hi @SooriyanDSRC, could you please provide a codesandbox showing the problem? It may be that a certain combination of props causes the problem. |
I face the same issue. @michaldudak here is a codesandbox link in case it helps. https://codesandbox.io/s/material-demo-forked-tlu40e?file=/demo.js |
Right, definitely a bug. Would you like to contribute to the project and look for a fix? |
@michaldudak Sure, I would be happy to work on the fix. The issue seems to be arising due to both marks having the same key as shown in the below image. How does this look? diff --git a/packages/mui-base/src/SliderUnstyled/SliderUnstyled.js b/packages/mui-base/src/SliderUnstyled/SliderUnstyled.js
index 4536cbe2c1..5559e274d4 100644
--- a/packages/mui-base/src/SliderUnstyled/SliderUnstyled.js
+++ b/packages/mui-base/src/SliderUnstyled/SliderUnstyled.js
@@ -210,7 +210,7 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) {
}
return (
- <React.Fragment key={mark.value}>
+ <React.Fragment key={index}>
<Mark
data-index={index}
{...markProps} |
Looks good to me. Please create a PR with this change. |
@michaldudak Created the PR #33526 |
Duplicates
Latest version
Current behavior 馃槸
Whenever both the start and the end points have been dragged to the end of the slider an extra mark has been added at the end of the slider which is visible when both the drag points aren't at the end.
Expected behavior 馃
The extra mark in the slider must be removed and retain the required marks that has been provided in the props.
Steps to reproduce 馃暪
Steps:
Context 馃敠
We have been using the range slider for a requirement in our project, where the user needs to choose certain range and the user needs to be provided with the labels of their selections. Since the marks might overwrite one another we needed to keep the marks to the minimal amount, In this case its getting added up by one.
Your environment 馃寧
`npx @mui/5.5.2`
The text was updated successfully, but these errors were encountered: