The caret is always set to the far right when deleting or inserting numbers when using the `$` currency sign
See original GitHub issueCurrent behavior
If user enters “$123.45” then places cursor to left of decimal (e.g. “$123|.45”), presses Backspace to delete the 3 or types a new number, the cursor moves all the way to the right. If user presses backspace again, the 5 is then deleted.
Expected behavior
If user enters $123.45 then places cursor to left of decimal (e.g. “$123|.45”), presses Backspace to delete the 3 or types a new number, the cursor should remain where it is.
Steps to reproduce the problem
- Use autoNumeric version 4.6.0
- In the browser Chrome version 81 and 83.
- On the Windows operating system
- Then instantiate the autoNumeric object with the following options:
CurrencySymbol: "$",
decimalCharacterAlternative: ",",
decimalPlacesRawValue: 2,
decimalPlacesShownOnBlur: 2,
decimalPlacesShownOnFocus: 2,
emptyInputBehavior: "always",
historySize: 5,
maximumValue: "999999",
minimumValue: "0",
negativePositiveSignPlacement: "p",
onInvalidPaste: "clamp",
unformatOnSubmit: true,
emptyInputBehavior: "zero",
modifyValueOnWheel: false
Link to live example (ie. Codepen)
https://www.quantumpayments.com/sandbox/Practice/autoNumericExample.html
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
When focusing on an input having `currencySymbolPlacement ...
When focusing while using the tab key on an input having currencySymbolPlacement as p (prefix), the caret is wrongly placed on the far...
Read more >Excel refuses to align a number left or center - YouTube
00:00 Number vs Currency vs Accounting Format - left aligned blocked00:15 Accounting format not aligning middle 00:25 Fix Accounting Format ...
Read more >Custom Excel number format - Ablebits
This tutorial explains the basics of the Excel number format and provides the detailed guidance to create custom formatting.
Read more >DOLLAR function - Microsoft Support
The DOLLAR function, one of the TEXT functions, converts a number to text using currency format, with the decimals rounded to the number...
Read more >Easy Number and Currency Formatting Library - autoNumeric
autoNumeric is a useful JavaScript library for international currency formatting as well as numbers formatting.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found another case, where this seems to occur - right now whenever I have a negative value (I used the code sample You provided) - whether it’s
$
or€
- the same issue occurs when I delete a digit.Steps to reproduce:
€
(comment the$
one)-
into itHowever an important factor is that it only occurs in select few negative value configs, namely:
negativePositiveSignPlacement: "l"
ornegativePositiveSignPlacement: "p"
Thesuffix
andright
values seem to work properly. So basically either for the$
itself or any currency symbol with a-
before it - it seems to reposition the caret to the end of the input value.@AlexandreBonneau - I see that a fix for this was merged into the codebase on July 7. However, it does not seem that a release has been cut with this fix. Would you happen to have an ETA for when a release might happen for this fix? Thanks for any info! 😄