mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-352: Ignore other input fields if they are invisible.
This commit is contained in:
@@ -1470,6 +1470,7 @@ Guacamole.Keyboard.InputSink = function InputSink() {
|
|||||||
this.focus = function focus() {
|
this.focus = function focus() {
|
||||||
window.setTimeout(function deferRefocus() {
|
window.setTimeout(function deferRefocus() {
|
||||||
field.focus(); // Focus must be deferred to work reliably across browsers
|
field.focus(); // Focus must be deferred to work reliably across browsers
|
||||||
|
field.select();
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1489,9 +1490,15 @@ Guacamole.Keyboard.InputSink = function InputSink() {
|
|||||||
|
|
||||||
// Do not refocus if focus is on an input field
|
// Do not refocus if focus is on an input field
|
||||||
var focused = document.activeElement;
|
var focused = document.activeElement;
|
||||||
if (focused && focused !== document.body)
|
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;
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Refocus input sink instead of handling click
|
// Refocus input sink instead of handling click
|
||||||
sink.focus();
|
sink.focus();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user