Slider: Warning NaN
for the bottom
css style property
#4686
Labels
Type: Bug
Issue contains a defect related to a specific component.
Milestone
Describe the bug
Hello,
I've noticed a small difference between vertical and horizontal Sliders:
When I create a vertical Slider with a 'min' property identical to the 'max' property, I get the following error in the console: "
Warning: 'NaN' is an invalid value for the 'bottom' css style property.
"But with a horizontal Slider, this error doesn't appear, whereas you'd expect something like "
Warning: 'NaN' is an invalid value for the 'left' css style property.
"It seems to me that the error appears because a division by (max-min) is made at some point.
The behavior should be homogeneous in the 2 cases (vertical and horizontal).
Personally, I'd prefer there to be no error in either case.
PS : Having a 'min' equal to the 'max' may seem strange.
In my case, I use the Slider to modify the depth of a graph, and the Slider's 'max' property is calculated according to the maximum depth of my graph. However, it is possible to have graphs with a single node. In this case, min = max
Reproducer
No response
PrimeReact version
9.6.0
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
<Slider value={value} onChange={(e) => setValue(e.value)} className="w-14rem" min={1} max={1} orientation="vertical"/>
--> Error in console<Slider value={value} onChange={(e) => setValue(e.value)} className="w-14rem" min={1} max={1} orientation="horizontal"/>
--> No error in consoleExpected behavior
No response
The text was updated successfully, but these errors were encountered: