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 maxlength attribute, decimal mode and fixed fraction digits won't overwrite decimals when maxlength is reached. #13868

Open
deathDog420 opened this issue Oct 12, 2023 · 0 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@deathDog420
Copy link

Describe the bug

When InputNumber has a set maxlength attribute, decimal mode and fixed fraction digits I cannot edit the decimals numbers. Number input example:

<p-inputNumber
    [(ngModel)]="testNumber"
    mode="decimal"
    name="testNumber"
    maxlength="6"
    [min]="0"
    [max]="999"
    [minFractionDigits]="2"
    [maxFractionDigits]="2"
    locale="en-US">
</p-inputNumber>

If I enter 3 digits into the input, for example 123, the input will show 123.00. If I then press the "." character to move to decimals, the insertion point moves to the decimal part, but when I enter a number to edit the decimal nothing happens. It seems that because the maximum character length is reached (in this case 6 characters) the input just ignores new entries. The input looks at the character length of the formatted value (123.00 is 6 characters). I would expect the continued typing after the decimal point to change the decimals regardless of the fact that maxlength is reached, just as they would be overwritten before the maxlength is reached.

Perhaps this can be fixed along with #13704.

Environment

Angular application with PrimeNg.

Reproducer

No response

Angular version

16.2.7

PrimeNG version

16.4.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.14.0

Browser(s)

Chrome (v118.0.5993.70)

Steps to reproduce the behavior

  1. Create p-inputnumber input field.
  2. Set input attributes as described in the issue description.
  3. Enter 3 digits into the field.
  4. Press "." to move to decimal part
  5. Try to enter a number to overwrite the decimals.

Decimals should be overwritten just as they would be overwritten before the maxlength is reached.

Expected behavior

I would expect the continued typing after the decimal point to overwrite the decimals regardless of the fact that maxlength is reached, just as they would be overwritten before the maxlength is reached.

@deathDog420 deathDog420 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 12, 2023
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

1 participant