primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-inputNumber moves cursor to the far right when inserting negative values with suffix

Open iarnaudov opened this issue 1 year ago • 6 comments

Describe the bug

After upgrading to 15.3.0, the number input fields started moving cursor to the far right after inserting negative numbers in a field with suffix.

The issue does not appear for positive number input. The issue is present in the official PrimeNG demo website The issue was NOT present in 14.1.2

Environment

Angular 15.2 using chromium based browser (Edge or Chrome)

Reproducer

No response

Angular version

15.2

PrimeNG version

15.3.0, but applies to latest

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.13.2

Browser(s)

Edge, Chrome

Steps to reproduce the behavior

  1. Use p-inputNumber with suffix in a page (% for example)
  2. Navigate to the page
  3. Put your cursor in the input field
  4. Type in '-' (negative sign) followed by some number Actual result: your cursor goes at the end, after the suffix Expected result: your cursor should stay after the inserted number.

Expected behavior

Your cursor should stay after the inserted number.

The issue does not appear for positive number input. The issue is present in the official PrimeNG demo website

iarnaudov avatar Jun 14 '23 07:06 iarnaudov

This issue still persists on v16.1.0, but now it happens whenever the input has a suffix, regardless of being a positive or negative number. However, on positive numbers, the cursor only shifts when a thousands separator is added (typing a number >= 1000) or removed. This is bothersome because when the cursor shifts to the far right, pressing backspace does nothing and you can't delete the number.

This behavior can be tested even in the InputNumber documentation: https://primeng.org/inputnumber#prefixsuffix

p-gaspar avatar Aug 02 '23 09:08 p-gaspar

Issue still exists in v16.7.2

jruprecht avatar Dec 18 '23 10:12 jruprecht

Issue still there in 17.12

davidediak avatar Apr 03 '24 10:04 davidediak

This is a heavy bug. We have already issue tickets from our customer. Is PrimeNG not able to fix such a heavy bug within 3 major releases or after 10 months?

SenfdazuGeber avatar Apr 17 '24 11:04 SenfdazuGeber

Issue still persists. Can you please fix this soon ?

sukeshkumarb avatar May 06 '24 13:05 sukeshkumarb

The same thing happens with positive numbers when you write 1000 or over (though it can be circumvented by using [useGrouping]="false" )

stajne avatar May 22 '24 08:05 stajne