Skip to content

Commit ca83b21

Browse files
focus on input when key is down and input is not in focus fix
1 parent 7068c56 commit ca83b21

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

webSource/js/Globals.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,23 @@ var AJAX = new function() {
6969
*/
7070
this.createTerminal = function (authKey, namespace) {
7171

72-
console.log(namespace);
72+
var term;
7373

74-
return new Terminal({
74+
term = new Terminal({
7575
container: document.body,
7676
authKey: authKey || null,
7777
defaultNamespace: namespace
7878
});
7979

80+
// fix for not active input on terminal window (fix placed here, because whole terminal app
81+
// can be embedded into another app and input focus can cause by-effect)
82+
window.addEventListener("keydown", function (e) {
83+
if (!e.ctrlKey && !e.shiftKey && !e.altKey
84+
&& term.elements.input !== document.activeElement) {
85+
term.input.focus();
86+
}
87+
});
88+
89+
return term;
90+
8091
};

0 commit comments

Comments
 (0)