primereact icon indicating copy to clipboard operation
primereact copied to clipboard

InputNumber: value doesn't respect value state

Open SmitNicolas opened this issue 1 year ago • 1 comments

Describe the bug

It seems that the value prop provided to <InputNumber/> isn't always correctly used.

The user can also think he's writing a value greater than the max value, because it's checked on blur. The value can be outdated even after component blur.

Reproducer

https://codesandbox.io/p/sandbox/charming-sea-99c8lj?file=%2Fsrc%2Fdemo%2FInputNumberDemo.js%3A28%2C21

PrimeReact version

9.3.1

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Select the input, its value should be 20 by default.
  2. Change value to 50.
  3. Click outside of the input. The value goes back to 30.

Expected behavior

  1. When trying to change the value, we shouldn't be able to write a value greater than max.
  2. The value in the input shouldn't change because its value prop is fixed.

SmitNicolas avatar Apr 17 '24 12:04 SmitNicolas

I think this is similar to: https://github.com/primefaces/primereact/issues/5091

melloware avatar Apr 17 '24 12:04 melloware