从蓝牙键盘在Safari onkeyup事件上IOS7 [英] onkeyup event in Safari on IOS7 from a bluetooth keyboard
问题描述
我有以下设置:
- 蓝牙扫描仪
- 的iPad
- 网页与扫描输入一个文本框
用法:
- 用户文本框的焦点和扫描棒code。与蓝牙扫描仪
- 扫描仪在扫描 的末尾添加回车(13)
- User focus textfield and scan barcode with bluetooth scanner
- Scanner adds ENTER (13) at the end of the scan
问题:
在Safari在IOS7似乎有键盘事件是如何在蓝牙设备处理的变化。
在code ...
On Safari in IOS7 there seems to be a change on how keyboard events are handled on bluetooth devices. The code ...
window.onkeyup = function (e) {
console.log(e.KeyboardEvent)
}
...应该返回有关的关键pressed信息。相反,我得到...
... should return information about the key pressed. Instead i get ...
keyCode: 0
keyIdentifier: "Unidentified"
......无论哪一个键我preSS。
... no matter which key I press.
同样的结果展位形式蓝牙扫描仪和蓝牙键盘。
Same result booth form bluetooth scanner and bluetooth keyboard.
谢谢/ E
推荐答案
似乎安其preSS的作品,仿佛预期。
Seems that "onkeypress" works as expected though.
由于这是一个问题,在一个煎茶触摸项目bumbed和煎茶触摸不会对文本框我张贴了code,它解决了我的问题的关键preSS事件。
Since this was a problem a bumbed in to in a Sencha Touch project and Sencha Touch doesn't have a keypress event on textfields I'm posting the code that solved my problem.
{
xtype:'searchfield',
name:'search',
placeHolder:'search',
listeners: {
painted: {
fn: function () {
var me = this;
me.element.dom.onkeypress = function (e) {
if (e.keyCode === 13) {
me.fireEvent('searchkeypress', me, e);
}
};
}
}
}
}
这篇关于从蓝牙键盘在Safari onkeyup事件上IOS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!