[Slider] marks type is invalid #19335
Labels
component: slider
This is the name of the generic UI component, not the React module!
ready to take
Help wanted. Guidance available. There is a high chance the change will be accepted
The slider prop type and typescript type allows the value
false
formarks
, but using this value will lead to the error "marks.map is not a function".The problem seems to be here: https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Slider/Slider.js#L386
Examining this code block, I was able to trigger the same error with the following properties as well:
marks={true} step={null}
(see here).marks={true} step={null}
is an invalid configuration, so it's ok to throw. But I think it should be checked explicitly and there should be a descriptive error message. Alternatively, the typescript and prop types can be adapted to not allow these two values together, see the expected behavior section for more information.Current Behavior 😯
When supplying the prop
marks={false}
, the Slider component throws an error.This also happens with
marks={false} step={null}
.Expected Behavior 🤔
I should not be able to set
false
as value in the first place - it should be prohibited by prop types and typescript.Alternative solutions:
marks={false}
or
[]
).Steps to Reproduce 🕹
https://codesandbox.io/s/material-demo-kg4fn
Steps:
marks={false}
on the Slider componentContext 🔦
Nothing special, just noticed this problem by accident.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: