jquery-console icon indicating copy to clipboard operation
jquery-console copied to clipboard

Remove depreciated Keypress event that doesn't work on android browsers

Open lain-d opened this issue 7 years ago • 1 comments

This branch update removes the onkeypress event.

Most logic is moved into the on keydown event.

At the onkeydown event, the current value of the typer is cached, then at the "input" event the current value is compared to the cached value, this will result in whatever the last character typed was, this character is inserted.

All control keys retain functionality.

Tested on Chrome, Android Chrome, iOS safari.

Thanks to this article for the inspiration for a solution!

https://www.outsystems.com/blog/javascript-events-unmasked-how-to-create-input-mask-for-mobile.html

lain-d avatar Feb 07 '18 18:02 lain-d

Hi @dan2600. I've been testing this and apparently everything is working as expected. I would love to see this one merged.

I would suggest to re order the code a bit, so the diff between the new version and the previous one isn't so big. This way the real changes are hard to track. Also i think you meant deprecated on the title.

Thanks for this fix!

luchotc avatar Feb 08 '18 12:02 luchotc