InputNumber: Selection lost when not selecting all content from left to right when prefix is enabled on the left. #15293
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
Hi
When using a prefixed number input with the prefix on the left, if not all the content is selected, and the selection includes the prefix, the selection is lost.
We think this may be a bug. We observed that bug from ngprime version 15 to 17. But may be present as far as version 10.
Here is some evidence to more clarity on the issue:
https://flashbackconnect.com/Default.aspx?id=S3gmOS4xCav-orBnZggxPg2
Here is the quick solution that we found.
Replacing this
primeng/src/app/components/inputnumber/inputnumber.ts
Line 1166 in 2655361
with:
Optional:
We also detected some unexpected, weird behaviors when selecting for example the fractional separator and then writing a number over it.
https://flashbackconnect.com/Default.aspx?id=IpG7FGymJErI6WP_g4i9sw2
To avoid that we added some sort of guard like this that clears the selection putting the cursor on the left side of the fractional separator.
Please let me know if this this solution fits and a PR is welcomed or if it can be improved.
Best Regards
Environment
Node 16, Angular 15, Edge 123, Windows 11
Reproducer
No response
Angular version
15
PrimeNG version
15.4.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
16
Browser(s)
Edge 123
Steps to reproduce the behavior
Expected behavior
The text was updated successfully, but these errors were encountered: