This repository was archived by the owner on Nov 28, 2018. It is now read-only.
Remove depreciated Keypress event that doesn't work on android browsers - #71
Open
lain-d wants to merge 8 commits into
Open
Remove depreciated Keypress event that doesn't work on android browsers#71lain-d wants to merge 8 commits into
lain-d wants to merge 8 commits into
Conversation
…evices, now will listen for onkeydown event, get current input value, then on "input" event get the new input value, figure out what character was added, and then add that new character to the console display, tested and works. thanks to this article : https://www.outsystems.com/blog/javascript-events-unmasked-how-to-create-input-mask-for-mobile.html
|
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. Thanks for this fix! |
This was referenced Feb 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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