-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve issue #549 - raising keypress by functional keys is Firefox #550
Conversation
2046ea9
to
229df30
Compare
// space is first typing symbol in UTF8 table | ||
if (k < keyCodes.space){ //see #549 | ||
return; | ||
} | ||
base.last.virtual = false; | ||
base.last.event = e; | ||
base.last.$key = []; // not a virtual keyboard key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for figuring out how to get around this problem... I'd like to keep the base.last
value up-to-date with every key event; please move the additions below the base.last.$key = [];
line and make sure everything still works for you.
js/jquery.keyboard.js
Outdated
@@ -753,6 +753,11 @@ http://www.opensource.org/licenses/mit-license.php | |||
k1 = k >= keyCodes.A && k <= keyCodes.Z, | |||
k2 = k >= keyCodes.a && k <= keyCodes.z, | |||
str = base.last.key = String.fromCharCode(k); | |||
// check, that keypress wasn't rise by functional key | |||
// space is first typing symbol in UTF8 table | |||
if (k < keyCodes.space && e.keyCode !== 0){ //see #549 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I force upload to add validation of e.keyCode for hard control of that we on keypress event with functional key.
@@ -753,6 +753,11 @@ http://www.opensource.org/licenses/mit-license.php | |||
k1 = k >= keyCodes.A && k <= keyCodes.Z, | |||
k2 = k >= keyCodes.a && k <= keyCodes.z, | |||
str = base.last.key = String.fromCharCode(k); | |||
// check, that keypress wasn't rise by functional key | |||
// space is first typing symbol in UTF8 table | |||
if (k < keyCodes.space){ //see #549 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete validation && e.keyCode !== 0
cause it not work for chrom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checking e.which
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It duplicate a keyCode
or have zero in FF for function keys and charCode
for others.
And it represent charCode
in Opera, Chrom, IE.
There is snippet, its helped me understand how keypress works in different browsers:
https://jsfiddle.net/VikEdit/9L3Lva82/
Hey @Vick-edit! Sorry, I forgot to include this PR in the last update... I'll review it again soon! |
Sorry for taking so long to get to this pull request... thanks again! |
I tried to resolve my issue #549 by analise difference in behavior of firefox and other browsers. Main difference is different data in event's varibles in firefox for events from text, number and symbols keys and fucntional keys.