mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-06-27 13:11:30 +02:00
Remove Firefox Alt workaround
The bug got fixed way back in Firefox 63, and it is also misbehaving with modern Firefox as they no longer consider AltGr an Alt-key.
This commit is contained in:
parent
33a113a475
commit
8b8201fd73
@ -29,7 +29,6 @@ export default class Keyboard {
|
|||||||
'keydown': this._handleKeyDown.bind(this),
|
'keydown': this._handleKeyDown.bind(this),
|
||||||
'keypress': this._handleKeyPress.bind(this),
|
'keypress': this._handleKeyPress.bind(this),
|
||||||
'blur': this._allKeysUp.bind(this),
|
'blur': this._allKeysUp.bind(this),
|
||||||
'checkalt': this._checkAlt.bind(this),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===== EVENT HANDLERS =====
|
// ===== EVENT HANDLERS =====
|
||||||
@ -312,30 +311,6 @@ export default class Keyboard {
|
|||||||
Log.Debug("<< Keyboard.allKeysUp");
|
Log.Debug("<< Keyboard.allKeysUp");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alt workaround for Firefox on Windows, see below
|
|
||||||
_checkAlt(e) {
|
|
||||||
if (e.skipCheckAlt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.altKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const target = this._target;
|
|
||||||
const downList = this._keyDownList;
|
|
||||||
['AltLeft', 'AltRight'].forEach((code) => {
|
|
||||||
if (!(code in downList)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const event = new KeyboardEvent('keyup',
|
|
||||||
{ key: downList[code],
|
|
||||||
code: code });
|
|
||||||
event.skipCheckAlt = true;
|
|
||||||
target.dispatchEvent(event);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===== PUBLIC METHODS =====
|
// ===== PUBLIC METHODS =====
|
||||||
|
|
||||||
grab() {
|
grab() {
|
||||||
@ -348,33 +323,12 @@ export default class Keyboard {
|
|||||||
// Release (key up) if window loses focus
|
// Release (key up) if window loses focus
|
||||||
window.addEventListener('blur', this._eventHandlers.blur);
|
window.addEventListener('blur', this._eventHandlers.blur);
|
||||||
|
|
||||||
// Firefox on Windows has broken handling of Alt, so we need to
|
|
||||||
// poll as best we can for releases (still doesn't prevent the
|
|
||||||
// menu from popping up though as we can't call
|
|
||||||
// preventDefault())
|
|
||||||
if (browser.isWindows() && browser.isFirefox()) {
|
|
||||||
const handler = this._eventHandlers.checkalt;
|
|
||||||
['mousedown', 'mouseup', 'mousemove', 'wheel',
|
|
||||||
'touchstart', 'touchend', 'touchmove',
|
|
||||||
'keydown', 'keyup'].forEach(type =>
|
|
||||||
document.addEventListener(type, handler,
|
|
||||||
{ capture: true,
|
|
||||||
passive: true }));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Log.Debug("<< Keyboard.grab");
|
//Log.Debug("<< Keyboard.grab");
|
||||||
}
|
}
|
||||||
|
|
||||||
ungrab() {
|
ungrab() {
|
||||||
//Log.Debug(">> Keyboard.ungrab");
|
//Log.Debug(">> Keyboard.ungrab");
|
||||||
|
|
||||||
if (browser.isWindows() && browser.isFirefox()) {
|
|
||||||
const handler = this._eventHandlers.checkalt;
|
|
||||||
['mousedown', 'mouseup', 'mousemove', 'wheel',
|
|
||||||
'touchstart', 'touchend', 'touchmove',
|
|
||||||
'keydown', 'keyup'].forEach(type => document.removeEventListener(type, handler));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._target.removeEventListener('keydown', this._eventHandlers.keydown);
|
this._target.removeEventListener('keydown', this._eventHandlers.keydown);
|
||||||
this._target.removeEventListener('keyup', this._eventHandlers.keyup);
|
this._target.removeEventListener('keyup', this._eventHandlers.keyup);
|
||||||
this._target.removeEventListener('keypress', this._eventHandlers.keypress);
|
this._target.removeEventListener('keypress', this._eventHandlers.keypress);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user