summaryrefslogtreecommitdiff
path: root/app/ui.js
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2019-10-31 16:24:06 +0100
committerSamuel Mannehed <samuel@cendio.se>2019-10-31 16:24:06 +0100
commit94a01b0ae0b735c2da794e7870bf972a68fece69 (patch)
tree8761a7127ee00b4a03f6b3aedf3746fd73eff12a /app/ui.js
parent8c51e9a8a28afb0a46570fa557dab511d4af6d15 (diff)
downloadnovnc-94a01b0ae0b735c2da794e7870bf972a68fece69.tar.gz
Keep the virtual keyboard after using extra keys
If using the extra keys always gives focus to the screen then an on-screen keyboard would be closed. When using on-screen keyboards we instead want to give focus to our virtual keyboard input element.
Diffstat (limited to 'app/ui.js')
-rw-r--r--app/ui.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/ui.js b/app/ui.js
index 15698b9..48e4d13 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -1552,9 +1552,19 @@ const UI = {
sendKey(keysym, code, down) {
UI.rfb.sendKey(keysym, code, down);
- // move focus to the screen in order to be able to
- // use the keyboard right after these extra keys
- UI.rfb.focus();
+
+ // Move focus to the screen in order to be able to use the
+ // keyboard right after these extra keys.
+ // The exception is when a virtual keyboard is used, because
+ // if we focus the screen the virtual keyboard would be closed.
+ // In this case we focus our special virtual keyboard input
+ // element instead.
+ if (document.getElementById('noVNC_keyboard_button')
+ .classList.contains("noVNC_selected")) {
+ document.getElementById('noVNC_keyboardinput').focus();
+ } else {
+ UI.rfb.focus();
+ }
// fade out the controlbar to highlight that
// the focus has been moved to the screen
UI.idleControlbar();