react-spectrum
react-spectrum copied to clipboard
[Slider]: Warning: Received NaN for the `max` attribute. If this is expected, cast the value to a string.
Provide a general summary of the issue here
I receive this while testing with RTL. Received it for multiple attributes like value.
Tried to patch the value like:
const value =
mergedProps.value || mergedProps.value === 0 ? mergedProps.value : '';
But then max attribute is NaN.
The input is like the one provided in the docs:
<VisuallyHidden>
<input ref={inputRef} {...mergedProps} value={value} />
</VisuallyHidden>
๐ค Expected Behavior?
No warnings raised
๐ฏ Current Behavior
Some error messages:
Warning: Received NaN for the max attribute. If this is expected, cast the value to a string.
Warning: Received NaN for the value attribute. If this is expected, cast the value to a string.
๐ Possible Solution
Cast this value inside the useSliderThumb or when is appropriate. Found a similar issue here: https://github.com/adobe/react-spectrum/issues/5499
๐ฆ Context
Create a custom slider component for Neo4j's component library based on the Slider primitives (useSlider, useSliderThumb, useSliderState).
๐ฅ๏ธ Steps to Reproduce
The example from the docs page is sufficient for this
Version
3.31.0
What browsers are you seeing the problem on?
Other
If other, please specify.
JS-dom
What operating system are you using?
MacOS
๐งข Your Company/Team
Neo4j - Design System
๐ท Tracking Issue
No response