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

p-inputNumber: With suffix and minDigits > 0, negative numbers lead to an unexpected cursor jump and frozen inputs #13651

Closed
johanneszelger opened this issue Sep 11, 2023 · 0 comments · Fixed by #13640
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@johanneszelger
Copy link
Contributor

Describe the bug

When a p-inputNumber element has minFractionDigits>1 and suffix defined, there is a bug in concatValues() for negative values.

For example having minFractionDigits=2 and suffix=" %":

After typing -0, concatValues() produces -00 instead of 0.00 %. This is because the differentiation between an existing and no existing decimalCharacter is missing, this differentiation is only made if there is no suffix defined.

After when updating the value, after concatValues() there is another call of formatValue() in handleOnInput(). The format is then corrected to -0.00 %, but the cursor's position is put to the end of the input: "0.00 %|" instead of "0|.00 %". Further this results in the user not being able to type any more

Environment

Reproducer

No response

Angular version

16.2.1

PrimeNG version

16.3.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

Browser(s)

No response

Steps to reproduce the behavior

  1. Create p-inputNumber with minFractionDigits=2 and suffix (any)
  2. Type '-'
  3. Type '0'
  4. Now you cant edit the number before leaving the input and entering again.

Expected behavior

No response

@johanneszelger johanneszelger added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 11, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 10, 2024
@cetincakiroglu cetincakiroglu added this to the 17.3.2 milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants