react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

[Slider]: Warning: Received NaN for the `max` attribute. If this is expected, cast the value to a string.

Open konsalex opened this issue 1 year ago โ€ข 0 comments

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

konsalex avatar Feb 13 '24 08:02 konsalex