You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/16 18:42:01 UTC
[15/23] guacamole-client git commit: GUACAMOLE-352: Ignore other
input fields if they are invisible.
GUACAMOLE-352: Ignore other input fields if they are invisible.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/e5e01beb
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/e5e01beb
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/e5e01beb
Branch: refs/heads/master
Commit: e5e01beb60a780a54da2c7763d7f70a32adba913
Parents: 7b29f7b
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Dec 18 14:07:24 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Jan 16 10:20:42 2018 -0800
----------------------------------------------------------------------
guacamole-common-js/src/main/webapp/modules/Keyboard.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/e5e01beb/guacamole-common-js/src/main/webapp/modules/Keyboard.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
index 0563f72..3a114db 100644
--- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js
+++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
@@ -1470,6 +1470,7 @@ Guacamole.Keyboard.InputSink = function InputSink() {
this.focus = function focus() {
window.setTimeout(function deferRefocus() {
field.focus(); // Focus must be deferred to work reliably across browsers
+ field.select();
}, 0);
};
@@ -1489,8 +1490,14 @@ Guacamole.Keyboard.InputSink = function InputSink() {
// Do not refocus if focus is on an input field
var focused = document.activeElement;
- if (focused && focused !== document.body)
- return;
+ if (focused && focused !== document.body) {
+
+ // Only consider focused input fields which are actually visible
+ var rect = focused.getBoundingClientRect();
+ if (rect.left + rect.width > 0 && rect.top + rect.height > 0)
+ return;
+
+ }
// Refocus input sink instead of handling click
sink.focus();