Cursor moves to start when there is a 0 in the decimal, How to stop this behavior?
iHamzaKhanzada opened this issue · 3 comments
- OS: Windows
- Browser: Microsoft Edge
- Inputmask version: 5.0.9-beta.62
I first made sure I am using the latest and greatest version of inputmask (without obviously the jquery-inputmask as it has been deprecated), the version is 5.0.9-beta.62. I downloaded this release from the Github, opened the index.html page which has 3 textboxes, date, currency and email. My concern is purely with currency, here is the HTML of the demo I am testing
so here are the steps to reproduce:
Working scenario:
Type $ 0.51 in the currency textbox, leave the textbox and then click again on the textbox on the right most decimal part (1 in this case), the cursor stays where we have clicked, (Screenshot attached for reference)
Now the other case:
Type $ 0.50 in the currency textbox, leave the textbox and then click again on the textbox on the right most decimal part (0 in this case), the cursor pushes back to start, this should not happen (I want to disable this behavior of cursor moving) (screenshot attached)
Another scenario:
Type $0.05 in the currency textbox and leave the textbox and then click again on the textbox pointing the cursor before the 5 decimal part, the cursor moves back to start, unwanted behavior, screenshot attached
I was able to reproduce the same behavior. I think this might be a bug.
The reason is you have the option positionCaretOnClick
set to the default value of radixFocus
. So as I understand, the examples with 0.50
and 0.05
work correctly and the example with 0.51
doesn't.
There is a workaround for this - set positionCaretOnClick
to none
like this:
<input-mask alias="currency" prefix="$ " positionCaretOnClick="none"></input-mask>
Thanks, using positionCaretOnClick fixed the issue.
@iHamzaKhanzada , @Techn1c4l ,
Version 5.0.9-beta.68 updated the radixFocus to more desirable behavior.