Mottie / Keyboard

Virtual Keyboard using jQuery ~

Home Page:http://mottie.github.io/Keyboard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android (chrome): prev keypress is entered

Timmmy opened this issue · comments

Hi!

I've noticed an issue in chrome on Android.
The keyboard inserts the previous stroke instead of current. Except for the first, that one is ok.

For example pressing abcd turns into aabc.
Any ideas?
Occurs on two different devices. Examples on the site van be used to reproduce.

Any ideas?

Thanks in advance!!

Tim

Just confirmed that it also occurs in Firefox for Android!
It also seems to be present in version 1.24.1

Hi @Timmmy!

Hmm, to me it appears that the touch event is only showing the last key entered. So the first touch isn't entering anything.

For now, try setting the keyBinding option to 'touchstart' (default is 'mousedown touchstart') because internally the plugin is trying to prevent adding a value if both of those events fire, but I think it's preventing it from happening.

I'll try to spend more time investigating this issue when I get some free time today.

Hi @Mottie,

Thanks for the quick reply.
Tried both mousedown only and touchstart only, but that doesn't fix the issue.

However I found this:
When you replace in jquery.keyboard.js: last.key = $key.attr('data-value');
With: last.key = $(this).attr('data-value');
=> Then it works correctly for all "normal keys" (but still an issue for enter, backspace,...);

When setting an alert after this line, it is clear that the one but last value goes into last.key. This also clarifies that the function is only called once, even with both bindings enabled.

Hope this gives you at least a clue?

Thanks in advance!

Hmm, that is very odd.

$key should be the same as $(this) unless you're using the mouswheel, which shouldn't be working on a touch device. Try setting the useWheel option to false and see if that fixes the problem. Or, just make sure the mousewheel plugin isn't being loaded.

Hi Mottie!

You're genious!
Setting useWheel to false indeed fixes the problem.

However I also don't see why this interfers on Android devices.

Thanks!!

I'm glad that fixed the issue!

I don't know why the mousewheel would interfere either... I'll take a look at the mousewheel plugin when I get some time.

I believe I found and fixed the issue causing the previous key to be entered. So no more need to be extra vigilant and ensure the mousewheel plugin isn't being loaded.

Thanks a lot for the fix!
I'll give it a go :)