formatter.js
formatter.js copied to clipboard
Formatter allows 't' to be typed in for certain patterns
Formatter allows 't' to be typed in credit card demo, but not in phone number demo.
Discovered in Chrome on OS X.
I ran into the same issue. This is because t
returns the keyCode 116
which is mapped to F5
in the isSpecialKeypress
method. That makes the t
character keypress return true here which subsequently does not prevent the default and does not call _processKey
.
I went ahead and simply disabled it in my fork to ensure that was the cause (it was). I am working on providing a better solution that will not break previous functionality required by the F5
mapping. I will submit a PR to this repo once I have gotten that worked out and once my previous PR gets merged (or rejected) so I can clean up my branches.
@kyledetella: is your current solution still to just comment out the mapping for F5
? Were you able to come up with something more elegant?
@grrizzly The quick fix was to comment it out. That is certainly less than ideal. I will get around to working on a more practical fix (hopefully) soon.
Also, it looks like there has been some other work around this in #70. That may be something to keep an eye on.
https://github.com/firstopinion/formatter.js/pull/70 is mine. I've looked into rules about key and ascii codes and this looks like the exact solution. I already use it in my app and it works fine. Although I'm not sure if this library actually needs some processing of F5.
Just forked this repository and merged some of pull requests which also fixes this issue: https://github.com/mort3za/formatterjs2