carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.62k stars 1.77k forks source link

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

Open mohakgemini opened 1 month ago

mohakgemini commented 1 month ago

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:

Actual Behavior:

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

guidari commented 1 month ago

It looks like is using a lot of memory in the browser also