Skip to content

[Bug]: Unexpected Increment Behavior in NumberInput Component with Step Prop #16865

Closed
@mohakgemini

Description

@mohakgemini

Package

@carbon/react

Browser

Chrome

Package version

v1.60.2

React version

v20.15.0

Description

When using the NumberInput component with a step prop, the increment behavior is not as expected. Specifically, when the default value is set to "1000" and the step prop is set to 1000, pressing the "+" button should increment the value to "2000". However, the value first increases to "1001" instead. Upon pressing the "+" button again, the value increments to "2001".

Also, the storybook crashes when trying to replicate the same in storybook

Expected Behavior:

  • Default value: 1000
  • step prop value: 1000
  • First press of the "+" button should set the value to 2000.
  • Subsequent presses should continue to increment the value by 1000.

Actual Behavior:

  • Default value: 1000
  • step prop value: 1000
  • First press of the "+" button sets the value to 1001.
  • Second press sets the value to 2001.

Reproduction/example

https://stackblitz.com/edit/github-mrrrn4-kvfdxe?file=src%2FApp.jsx

Steps to reproduce

  1. Set up a NumberInput component with a default value of "1000".
  2. Add a step prop with a value of 1000.
  3. Press the "+" button.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

Metadata

Metadata

Assignees

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions