primeng icon indicating copy to clipboard operation
primeng copied to clipboard

InputNumber Component: Unable to enter numbers if minFractionDigits and maxFractionDigits are set to null

Open timandella opened this issue 1 year ago • 3 comments

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 avatar Apr 11 '24 08:04 timandella

I'm facing the same issue

ibrahim-azez avatar Apr 17 '24 19:04 ibrahim-azez

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 avatar Apr 19 '24 07:04 timandella

This looks like it has been resolved in the latest release (although another related issue has manifested itself - https://github.com/primefaces/primeng/issues/15346)

timandella avatar Apr 24 '24 08:04 timandella

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

mehmetcetin01140 avatar May 20 '24 13:05 mehmetcetin01140

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

GabrielAPineiro avatar May 20 '24 14:05 GabrielAPineiro

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 - https://github.com/primefaces/primeng/issues/15346

timandella avatar May 22 '24 07:05 timandella