inputnumber : not able to type "."(dot) or comma"with"(respective locale) for decimal point. Need to move the cursor manually to enter digit after decimal point
ngular version: 9.1.1 PrimeNG version: 9.1.0
snapshot

User is getting frustrated due to to this.
Got the same issue with v9.1.0 and Angular 9.1.8... Also happens with the components on the showcase page of the inputNumber
OMG this is so infuriating. Another problem is that for example in showcase page when you select whole "Currency -> United States" value and input something like "1" it puts "$1,00" and cursor moves to the end of input and you are unable to write... ok I am switching to ngx-mask for now.
Thanks a lot for your feedbacks! Could you please test these issues on PrimeReact inputNumber? https://primefaces.org/primereact/showcase/#/inputnumber if it works fine for you, I can add new improvements to PrimeNg. This component is open to user experiences. Therefore, feedback is important to us.
Thanks again! Best Regards,
Hello. On PrimeReact inputNumber the behaviour is better, but still weird.
I'm testing on Windows with Chrome.
For example, if you tab focus from United States to Germany and try to type a number like 123,00 the first keystroke works and move the cursor to the end, after the € symbol.
The same happens on United States if you position the cursor at the end and select all with Shift+Home. Trying to type a number like 123,00 happens to work only for the first algarism.
Fixed in https://github.com/primefaces/primeng/commit/1258ca4d4b7a15575fa950fc83af980f2107d3d5
Similar issue; https://github.com/primefaces/primeng/issues/8900
Thanks a lot for the feedbacks, Best Regards,
This still seems to be an issue.
I'm using version 11.3.1 and if I try to type a decimal in an input, it doesn't allow me to type the decimal separator. The workaround I've found is setting minFractionDigits to 1 but you'd expect an input in decimal mode to allow you to actually type decimals into it regardless of the minimum fraction digits.
Example code:
<p-inputNumber mode="decimal" max="100" [step]="2.5" suffix="%">
I'm having this issue with PrimeNG 11.4.2
I had the same issue, I fixed it by the following way:
First, I used the ViewChild() method to access through the input element:
@ViewChild('inputReference', { read : ElementRef }) inputElement: ElementRef;
And then, I wrote some logic to handle when the input was or not focused. With that in mind, I used a host listener to handle commas key pressed and update the input value:
@HostListener('keydown', ['$event.key'])
onKeyDown(key: string) {
if(
this.isControlFocused
&& key === ','
&& this.inputElement.nativeElement.firstChild.childNodes[0].value.indexOf(',') === -1) {
this.inputElement.nativeElement.firstChild.childNodes[0].value += ',';
}
Hi everyone,
I am working on version 17.12.0, and it did not let me use decimal punctuation marks even though I selected the decimal mode. As @JordanMunroe said, the problem lies in how min and max are treated when entering a decimal number. Since I don't want to force my user always to enter decimal numbers I have found this way to enable the decimal '.' using [minFractionDigits] and [maxFractionDigits].
<p-inputNumber
class="text-center"
formControlName="weighting"
mode="decimal"
[size]="7"
[maxlength]="6"
[step]="0.1"
inputId="weighting"
[minFractionDigits]="0"
[maxFractionDigits]="3"
[min]="0.00"
[max]="100.00" />
It could be useful to someone, or I'm giving it a lot of thought and it seems easier than it is. Regards!