primeng icon indicating copy to clipboard operation
primeng copied to clipboard

BUG: `p-inputnumber` updates cursor position when value is 0 (Fix is provided in PR already)

Open Aaronzinhoo opened this issue 5 years ago • 4 comments

Fix

provided here

If you have a PrimeNG PRO Support subscription please post your issue at;

https://pro.primefaces.org

where our team will respond within 4 business hours.

If you do not have a PrimeNG PRO Support subscription, fill-in the report below. Please note that your issue will be added to the waiting list of community issues and will be reviewed on a first-come first-serve basis, as a result, the support team is unable to guarantee a specific schedule on when it will be reviewed. Thank you for your understanding.

Current Queue Time for Review Without PRO Support: ~8-12 weeks. With PRO Support: 1 hour

I'm submitting a ... (check one with "x")

[ x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

What

This is a fix to the p-inputnumber component. The bug caused by the component is due to the fact that when an p-inputnumber component has a suffix & its value is 0. These image are based on the deployed version of primeng site here

Example: image

After typing some numbers in, the cursor goes behind the suffix like so and does not allow the user to backspace to delete any number any more. image

Why

Within the updateInput function, the case for inserting a value when newLength===oldLength & the current operation is insert, always moves the cursor position up 1 regardless of the value. In the case of zero this should not occur (the value zero should simple be replaced).

Aaronzinhoo avatar Jul 15 '21 16:07 Aaronzinhoo

Hi,

I think this issue has been fixed in 12.1.1.

For now, closed. If the problem persists, please reopen this ticket. Best Regards,

mertsincan avatar Sep 06 '21 14:09 mertsincan

I feel like the issue is still there: https://stackblitz.com/edit/github-hvx4mt?file=src%2Fapp%2Fapp.component.html, or am I doing something wrong here @mertsincan? Version is 12.2.1

Quacck avatar Oct 30 '21 16:10 Quacck

This still happen.

https://primeng.org/inputnumber#prefixsuffix Try to type long number quickly "in the column with Suffix character". The cursor will move to the end and can't press Backspace to delete anymore.

Now I use [useGrouping]="false" to disable thousands separator, then it work fine.

gjlmotea avatar Apr 20 '24 14:04 gjlmotea

@mertsincan can we get this looked at once more

Aaronzinhoo avatar Apr 27 '24 04:04 Aaronzinhoo