Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputNumber with min triggers onValueChange immediately if value is nully #2136

Closed
VsevolodGolovanov opened this issue Jun 23, 2021 · 1 comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@VsevolodGolovanov
Copy link

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)
https://codesandbox.io/s/inputnumber-onvaluechangemin-taints-the-value-0l8fs

Current behavior
InputNumber with min triggers onValueChange immediately if value is null or undefined.

Expected behavior
InputNumber should leave null/undefined value as is, shouldn't trigger onValueChange when the field wasn't touched by user at all. min shouldn't try to reimplement requiredness - that's a separate matter. It's reasonable to accept a validated number in a certain range or no number at all.

Minimal reproduction of the problem with instructions
Open the linked codesandbox. See 1 appear in the field without any input.

Please tell us about your environment:

  • React version:
  • PrimeReact version:
    6.3.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
@VsevolodGolovanov
Copy link
Author

VsevolodGolovanov commented Jun 23, 2021

Can be partially worked around with min={value !== null ? min : undefined} - at least then it won't change the value immediately. But you won't be able to delete the number once you started to input it.

This was referenced Jun 28, 2021
@mertsincan mertsincan added this to the 7.0.0 milestone Jul 31, 2021
@mertsincan mertsincan added the Status: Discussion Issue or pull request needs to be discussed by Core Team label Jul 31, 2021
@mertsincan mertsincan added Type: Bug Issue contains a defect related to a specific component. and removed Status: Discussion Issue or pull request needs to be discussed by Core Team labels Sep 10, 2021
@mertsincan mertsincan modified the milestones: 7.0.0, 6.5.2 Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants