GUACAMOLE-724: Allow keyboard interaction with client notifications.

This commit is contained in:
Michael Jumper
2021-07-04 13:19:42 -07:00
parent 025775a040
commit da62cb1afd
2 changed files with 20 additions and 4 deletions

View File

@@ -407,6 +407,23 @@ angular.module('client').directive('guacClientNotification', [function guacClien
}); });
/**
* Prevents the default behavior of the given AngularJS event if a
* notification is currently shown and the client is focused.
*
* @param {event} e
* The AngularJS event to selectively prevent.
*/
var preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
if ($scope.status && $scope.client.clientProperties.focused)
e.preventDefault();
};
// Block internal handling of key events (by the client) if a
// notification is visible
$scope.$on('guacBeforeKeydown', preventDefaultDuringNotification);
$scope.$on('guacBeforeKeyup', preventDefaultDuringNotification);
}]; }];
return directive; return directive;

View File

@@ -163,9 +163,8 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
// Broadcast keydown events // Broadcast keydown events
keyboard.onkeydown = function onkeydown(keysym) { keyboard.onkeydown = function onkeydown(keysym) {
// Do not handle key events if not logged in or if a notification is // Do not handle key events if not logged in
// shown if ($scope.applicationState !== ApplicationState.READY)
if ($scope.applicationState !== ApplicationState.READY || guacNotification.getStatus())
return true; return true;
// Warn of pending keydown // Warn of pending keydown
@@ -184,7 +183,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
// Do not handle key events if not logged in or if a notification is // Do not handle key events if not logged in or if a notification is
// shown // shown
if ($scope.applicationState !== ApplicationState.READY || guacNotification.getStatus()) if ($scope.applicationState !== ApplicationState.READY)
return; return;
// Warn of pending keyup // Warn of pending keyup