Allow right and left arrow key to be used while navigating inside all input types (e.g. cvc, expiry, card number and numeric)
Why introduce these changes?
Firefox (with vendored payform) currently does not allow users to perform arrow key navigation because keypress keyboard events are surfaced in the event handler that restricts all non-numeric keys (with some exceptions). keypress events are not raised in Chrome, Safari and Firefox
How is this achieved?
In the restrictNumeric keyPress event handler, we can filter out right and left arrow keys key codes (i.e. 37 and 39)
Extract key codes used in all comparison operators into a global variable called keyCodes and use it instead of using number types and in-line comments. While it may not be the most performant, it keeps in mind legacy browser support (i.e. IE < 8)
Changes
Why introduce these changes?
keypress
keyboard events are surfaced in the event handler that restricts all non-numeric keys (with some exceptions).keypress
events are not raised in Chrome, Safari and FirefoxHow is this achieved?
In the
restrictNumeric
keyPress event handler, we can filter out right and left arrow keys key codes (i.e. 37 and 39)Extract key codes used in all comparison operators into a global variable called
keyCodes
and use it instead of using number types and in-line comments. While it may not be the most performant, it keeps in mind legacy browser support (i.e. IE < 8)