mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-232: Do not rely on receiving keyup events on iOS.
This commit is contained in:
@@ -65,6 +65,13 @@ Guacamole.Keyboard = function(element) {
|
||||
*/
|
||||
var quirks = {
|
||||
|
||||
/**
|
||||
* Whether keyup events are universally unreliable.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
keyupUnreliable: false,
|
||||
|
||||
/**
|
||||
* Whether the Alt key is actually a modifier for typable keys and is
|
||||
* thus never used for keyboard shortcuts.
|
||||
@@ -79,8 +86,12 @@ Guacamole.Keyboard = function(element) {
|
||||
// available
|
||||
if (navigator && navigator.platform) {
|
||||
|
||||
// All keyup events are unreliable on iOS (sadly)
|
||||
if (navigator.platform.match(/ipad|iphone|ipod/i))
|
||||
quirks.keyupUnreliable = true;
|
||||
|
||||
// The Alt key on Mac is never used for keyboard shortcuts
|
||||
if (navigator.platform.match(/^mac/i))
|
||||
else if (navigator.platform.match(/^mac/i))
|
||||
quirks.altIsTypableOnly = true;
|
||||
|
||||
}
|
||||
@@ -211,7 +222,7 @@ Guacamole.Keyboard = function(element) {
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.keyupReliable = true;
|
||||
this.keyupReliable = !quirks.keyupUnreliable;
|
||||
|
||||
// DOM3 and keyCode are reliable sources if the corresponding key is
|
||||
// not a printable key
|
||||
@@ -1021,7 +1032,7 @@ Guacamole.Keyboard = function(element) {
|
||||
} // end if keydown
|
||||
|
||||
// Keyup event
|
||||
else if (first instanceof KeyupEvent) {
|
||||
else if (first instanceof KeyupEvent && !quirks.keyupUnreliable) {
|
||||
|
||||
// Release specific key if known
|
||||
var keysym = first.keysym;
|
||||
|
Reference in New Issue
Block a user