ladle icon indicating copy to clipboard operation
ladle copied to clipboard

Range control with a default value of zero does not adopt default value

Open zackheil opened this issue 1 year ago • 0 comments

Describe the bug

I tried setting a range control and wanted the default value to be zero. I discovered that this works for any non-zero value, but zero puts the range control at 50% visually and you get the react warning when setting it for the first time Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.

Reproduction

Here's a stackblitz repro: https://stackblitz.com/edit/ladle-jcsl2b?file=src%2Fbasic.stories.tsx

Environment

  • OS: (all)
  • Browser: (all)
  • Version: Has existed since at least 2.x.x

zackheil avatar Feb 04 '24 18:02 zackheil