Skip to content

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

@zackheil

Description

@zackheil

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions