diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html
index fd6fbc406..4528040d2 100644
--- a/guacamole/src/main/webapp/app/client/templates/client.html
+++ b/guacamole/src/main/webapp/app/client/templates/client.html
@@ -39,7 +39,7 @@
-
+
diff --git a/guacamole/src/main/webapp/app/textInput/directives/guacTextInput.js b/guacamole/src/main/webapp/app/textInput/directives/guacTextInput.js
index 66a04aa51..dc9600f12 100644
--- a/guacamole/src/main/webapp/app/textInput/directives/guacTextInput.js
+++ b/guacamole/src/main/webapp/app/textInput/directives/guacTextInput.js
@@ -28,7 +28,17 @@ angular.module('textInput').directive('guacTextInput', [function guacTextInput()
return {
restrict: 'E',
replace: true,
- scope: {},
+ scope: {
+
+ /**
+ * Whether the text input UI should have focus. Setting this value
+ * is not guaranteed to work, due to browser limitations.
+ *
+ * @type Boolean
+ */
+ needsFocus : '=?'
+
+ },
templateUrl: 'app/textInput/templates/guacTextInput.html',
controller: ['$scope', '$rootScope', '$element', '$timeout',
@@ -324,6 +334,16 @@ angular.module('textInput').directive('guacTextInput', [function guacTextInput()
e.preventDefault();
}, false);
+ // Attempt to change focus depending on need
+ $scope.$watch('needsFocus', function focusDesireChanged(focusNeeded) {
+
+ if (focusNeeded)
+ target.focus();
+ else
+ target.blur();
+
+ });
+
// If the text input UI has focus, prevent keydown events
$scope.$on('guacBeforeKeydown', function filterKeydown(event, keysym) {
if (hasFocus && !ALLOWED_KEYS[keysym])