primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.97k stars 1.06k forks source link

InputNumber: Typing in value doesn't work correctly when min is set #6315

Closed barelyconfused closed 7 months ago

barelyconfused commented 7 months ago

Describe the bug

When setting min to 2, user cannot type in 12, since it resets the value to 2. This happens when onChange is used instead of onValueChange

Reproducer

No response

PrimeReact version

10.6.2

React version

17.x

Language

ES6

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

1) Set min to 2 2) Set onChange handler 3)Type in 12 4) result is 2

Expected behavior

Value should be set to 12

github-actions[bot] commented 7 months ago

Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days.

melloware commented 7 months ago

I think you need to use onValueChange as all the examples on thew Showcase show.

barelyconfused commented 7 months ago

OnValueChange has issues in my case. I have a dialog, and 2 Number inputs. If i change the first input by typing and then immediately "click" on the second inputs button to change its value, after i click save, the first value is not saved. This is because onValueChange only fires on blur. Since the state is updated when the button is clicked, the first value has not been updated yet.

melloware commented 7 months ago

Can you provide a reproducer of the issue and I will re-open the ticket.