Revert iOS keyup workaround
It seems Apple has fixed their buggy keyup events, so remove the
workaround and allow keys to be kept pressed again.
This is a revert of 9e99ce126c
.
This commit is contained in:
parent
9d956e9198
commit
8c51e9a8a2
|
@ -118,9 +118,7 @@ export default class Keyboard {
|
||||||
|
|
||||||
// We cannot handle keys we cannot track, but we also need
|
// We cannot handle keys we cannot track, but we also need
|
||||||
// to deal with virtual keyboards which omit key info
|
// to deal with virtual keyboards which omit key info
|
||||||
// (iOS omits tracking info on keyup events, which forces us to
|
if (code === 'Unidentified') {
|
||||||
// special treat that platform here)
|
|
||||||
if ((code === 'Unidentified') || browser.isIOS()) {
|
|
||||||
if (keysym) {
|
if (keysym) {
|
||||||
// If it's a virtual keyboard then it should be
|
// If it's a virtual keyboard then it should be
|
||||||
// sufficient to just send press and release right
|
// sufficient to just send press and release right
|
||||||
|
|
|
@ -175,54 +175,6 @@ describe('Key Event Handling', function () {
|
||||||
};
|
};
|
||||||
kbd._handleKeyDown(keyevent('keydown', {code: 'Unidentified', key: 'a'}));
|
kbd._handleKeyDown(keyevent('keydown', {code: 'Unidentified', key: 'a'}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('iOS', function () {
|
|
||||||
let origNavigator;
|
|
||||||
beforeEach(function () {
|
|
||||||
// window.navigator is a protected read-only property in many
|
|
||||||
// environments, so we need to redefine it whilst running these
|
|
||||||
// tests.
|
|
||||||
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
|
|
||||||
if (origNavigator === undefined) {
|
|
||||||
// Object.getOwnPropertyDescriptor() doesn't work
|
|
||||||
// properly in any version of IE
|
|
||||||
this.skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(window, "navigator", {value: {}});
|
|
||||||
if (window.navigator.platform !== undefined) {
|
|
||||||
// Object.defineProperty() doesn't work properly in old
|
|
||||||
// versions of Chrome
|
|
||||||
this.skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
window.navigator.platform = "iPhone 9.0";
|
|
||||||
});
|
|
||||||
afterEach(function () {
|
|
||||||
Object.defineProperty(window, "navigator", origNavigator);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should fake keyup events on iOS', function (done) {
|
|
||||||
if (browser.isIE() || browser.isEdge()) this.skip();
|
|
||||||
let count = 0;
|
|
||||||
const kbd = new Keyboard(document);
|
|
||||||
kbd.onkeyevent = (keysym, code, down) => {
|
|
||||||
switch (count++) {
|
|
||||||
case 0:
|
|
||||||
expect(keysym).to.be.equal(0x61);
|
|
||||||
expect(code).to.be.equal('KeyA');
|
|
||||||
expect(down).to.be.equal(true);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
expect(keysym).to.be.equal(0x61);
|
|
||||||
expect(code).to.be.equal('KeyA');
|
|
||||||
expect(down).to.be.equal(false);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
kbd._handleKeyDown(keyevent('keydown', {code: 'KeyA', key: 'a'}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Track Key State', function () {
|
describe('Track Key State', function () {
|
||||||
|
|
Loading…
Reference in New Issue