Skip to content
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

Merged
merged 1 commit into from
Jun 3, 2017

Conversation

Vick-edit
Copy link
Contributor

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.

@Vick-edit Vick-edit force-pushed the master branch 2 times, most recently from 2046ea9 to 229df30 Compare April 17, 2017 11:05
// 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
Copy link
Owner

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.

@@ -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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Copy link
Owner

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?

Copy link
Contributor Author

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/

@Mottie
Copy link
Owner

Mottie commented Apr 25, 2017

Hey @Vick-edit!

Sorry, I forgot to include this PR in the last update... I'll review it again soon!

@Mottie Mottie merged commit d932985 into Mottie:master Jun 3, 2017
@Mottie
Copy link
Owner

Mottie commented Jun 3, 2017

Sorry for taking so long to get to this pull request... thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants