Skip to content

Conversation

@andyhsh
Copy link

@andyhsh andyhsh commented Jun 14, 2018

  • Fix CVC input field when user has typed in 4 digits fore Firefox

Reference: laurihy#97

if (!/^\d+$/.test(digit) && !e.meta && e.keyCode >= 46) {

// Allows backspace, delete and arrow keys when input length is 4 and the browser is Firefox
if (e.keyCode == 46 || e.keyCode == 8||(e.keyCode >=37 && e.keyCode <=40)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you know that it is Firefox here?

Copy link
Author

@andyhsh andyhsh Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raphaeldieu IE / Chrome / Safari detects the "keypress" event only when an actual character input is added. Since backspace and arrow keys don't add a new character, the function doesn't run.

For Firefox, the "keypress" event is run even on backspace / arrow keys and so with the old code when val.length is more than 4, it will always fall down to the else block which has a e.preventDefault() preventing the user from any form of input. The new code which detects arrow / delete / backspace keys therefore can only occur on firefox

}
}]);angular.module('angularPayments')
}])
;angular.module('angularPayments')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran grunt and I guess it changed the line. Didn't directly edit anything inside the /lib folder

@raphaeldieu raphaeldieu merged commit c5496ea into master Jun 25, 2018
@raphaeldieu raphaeldieu deleted the hotfix/firefox-cvc branch June 25, 2018 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants