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 Component: Unable to enter numbers if minFractionDigits and maxFractionDigits are set to null #15256

Closed
timandella opened this issue Apr 11, 2024 · 6 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@timandella
Copy link

timandella commented Apr 11, 2024

Describe the bug

When an inputNumber control is used, with the minFractionDigits and maxFractionDigits both explicitly set to null, then it is not possible to enter any number in the text box

For example, the html being used is this:

<p-inputNumber mode="decimal" [minFractionDigits]="minFractionDigits" [maxFractionDigits]="maxFractionDigits"> </p-inputNumber>

In the angular component, the relevant properties are set as follows:

public minFractionDigits?: number | null = null;
public maxFractionDigits?: number | null = null;

In this case, the textbox field does not accept numbers.

If the html is changed to remove the two properties altogether, then it works as expected. However "null" is meant to be the default value, and so you would expect it to work then the properties are set to this

Issue occurs in PrimeNg 17.13.0 but not in 17.12.0 (and all earlier versions).

Environment

Windows 10

Reproducer

https://stackblitz.com/edit/frgggh?file=src%2Fapp%2Fdemo%2Finput-number-numerals-demo.html

Angular version

17.3

PrimeNG version

17.13

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.19.0

Browser(s)

Edge

Steps to reproduce the behavior

Use a p-inputNumber component where the minFractionDigits and maxFractionDigits are explicitly set to null

Attempt to type in the text box

Expected behavior

Textbox accepts numbers

@timandella timandella added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 11, 2024
@ibrahim-azez
Copy link

I'm facing the same issue

@timandella
Copy link
Author

timandella commented Apr 19, 2024

It is also worth mentioning that a javascript error appears in the console for the Stackblitz example

vendor.js:60069  ERROR RangeError: minimumFractionDigits value is out of range.
    at new NumberFormat (<anonymous>)
    at InputNumber.constructParser (vendor.js:154565:25)
    at InputNumber.ngOnInit (vendor.js:154550:10)

This occurs when minimumFractionDigits is set to null, or undefined

@timandella
Copy link
Author

This looks like it has been resolved in the latest release (although another related issue has manifested itself - #15346)

@mehmetcetin01140
Copy link
Contributor

Hi, this issue is not present in the latest version of PrimeNG (17.17.0). I'm closing the issue.

@GabrielAPineiro
Copy link

https://stackblitz.com/edit/arnqz3?file=src%2Fapp%2Finput-number-currency-demo.html
The issue is still happening in the latest version

@timandella
Copy link
Author

I think there was some confusion between two tickets I raised (both around input number) This particular issue has been fixed. It is another issue that is still happening - #15346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

4 participants