Commit 36af7159 authored by H. Fischer's avatar H. Fischer
Browse files

Automatically focus textarea #50

parent 7a9de14c
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -139,3 +139,18 @@ export function main() {
}

window.onload = main

let verifiedTextareaExistance = false
let textareaElement = null
window.onkeydown = function () {
    if (!verifiedTextareaExistance) {
        textareaElement = document.querySelector("textarea.term_textarea")
        if (textareaElement) {
            verifiedTextareaExistance = true
        }
    }
    if (document.activeElement !== textareaElement) {
        console.log("Triggering")
        textareaElement.focus()
    }
}
 No newline at end of file