JS/JQuery按键和按键按下在Android设备上的不可预测的行为 [英] JS/ JQuery keyup and keydown Unpredictable behaviours on Android devices

查看:99
本文介绍了JS/JQuery按键和按键按下在Android设备上的不可预测的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Web应用程序,当用户在Web表单中键入内容时,我将在其中收集击键.到目前为止,它在台式机上运行良好,但在移动设备上(尤其是在Android设备上)却无法正常运行.这些行为是无法预测的.例如:

I am writing a web app where I collect the keystroke when the user type in the web forms. It is working fine so far on the desktop but on the mobile device and in particular Android devices it is not. The behaviours is kind unpredictable. For example:

  • 在某些设备上,退格键/删除键不会触发键事件,但在其他设备上,会触发键事件.
  • 修饰键(也称为Shift键)不会在某些设备上触发键事件,但会在其他设备上触发.
  • 在某些设备上可以正确检测到密钥代码,而在其他设备上则无法检测到.

例如,在使用本机浏览器的Samsung S4上,任何键始终将键码设为零.当我在Samsung S4上使用Chrome浏览器版本45.0.2454.84时,大多数键的键代码始终为229.

For example on Samsung S4 using the native browser will always give keycode equal zero for any key. When I used the chrome browser version 45.0.2454.84 on Samsung S4 the key code was always 229 for most of the keys.

使用Samsung Galaxy Ace 2上的本机浏览器,可以获得所有键的正确键代码(与在台式机上使用硬件键盘获得的键代码相同),但shift/modifier键不会触发

Using the native browser on Samsung Galaxy Ace 2, I get the correct key code for all the keys ( the same keycode I get using hardware keyboard on desktop) but the shift/modifier key does not fire

使用镀铬浏览器版本45.0.2454.84的Sony Xperia M4 Aqua,我为所有按键获得了正确的按键代码.再次,修改键不会触发.当我在Sony Xperia上使用本机浏览器时,键码等于零.

Using the Sony Xperia M4 Aqua, with chrome browser version 45.0.2454.84 I got the correct key code for all the keys. Agin the modifier key does not fire. When I use the native browser on the Sony Xperia I got the key code equal zero.

即使使用相同的浏览器"chrome浏览器版本45.0.2454.84",我在不同设备上的行为也不同,所以我找不到真正的模式.

I can not really find a pattern even using the same browser "chrome browser version 45.0.2454.84"give different behaviors on the different devices.

在iPhone iPad和Windows Phone上,我没有此问题.

On iPhone iPad and Windows Phone I do not have this problem.

推荐答案

我刚刚在Chromium中标记了一个错误. https://code.google.com/p/chromium/issues/detail ?id = 531234

I just flagged a bug in Chromium for that. https://code.google.com/p/chromium/issues/detail?id=531234

这篇关于JS/JQuery按键和按键按下在Android设备上的不可预测的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆