-
Notifications
You must be signed in to change notification settings - Fork 417
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
Caret jumps over the last digit and decimal character when pressing arrow key once #767
Comments
Hello and thanks for taking the time to report your feature request. This is a behavior that predates me becoming the maintainer of AutoNumeric, so I'm guessing this is the way it was since 2009! Now the question is; should the caret stops before and after the decimal point? Or should you be able for instance as it is now the case to count the number of numbers using the arrow keys? To be honest I'm not sure, as I got used to the way to just do an additional I guess we could add yet another option to make that behavior configurable, but trying to keep the code as small as possible, this goes against this idea, specially if this not needed by many people. If somebody else want this feature, please post here and I'll see what I can do. |
Hello and sorry it took so long for my reply. Thank you for the detailed answer and for explaining the background and that this is the intended behaviour! The approach you suggested sounds perfectly reasonable to me. As I said, for me it would be more intuitive if the cursor stopped at the decimal separator and didn't jump over it, but if I'm the only one who's bothered by that, you can close this issue sooner or later. If anyone else expresses interest in this, I'd be happy to create a PR. I have already looked into the code and would have thought of an option |
Current behavior
Consider the following situation: An autoNumeric input field contains the number
50,000.23
and the user wants to replace it with50,001.23
. The caret/text cursor is positioned in the front of the number (|50,000.23
).The user presses the right arrow key until the caret is positioned on the right of the last integer digit (
50,000|.23
), presses backspace and replaces the zero with a one. But surprise: When pressing the right arrow key on50,00|0.23
, the caret moves two characters to the right of the decimal character instead (50,000.|23
) and if the user presses backspace the decimal character is removed instead of the last integer digit (leading to a result of500,001.|23
if the user inserts the decimal character again).The behavior can be seen in this screen recording:
https://user-images.githubusercontent.com/1754883/234876454-38bfa195-337e-4aae-9790-19a39c7fcd71.mp4
Expected behavior
The caret should move from
50,00|0.23
to50,000|.23
when pressing the right arrow key.Steps to reproduce the problem (see video)
v.4.8.1
Chrome v112.0.5615.137
macOS
Link to live example
The described behavior can be checked out in the autoNumeric configurator: http://autonumeric.org/configurator
Thank you for developing this amazing package!
The text was updated successfully, but these errors were encountered: