Make credentials input focus logic easier to read

This commit is contained in:
dmotte 2026-05-22 19:10:08 +02:00
parent 0d82f835aa
commit 3cb3463365
1 changed files with 4 additions and 7 deletions

View File

@ -1288,16 +1288,13 @@ const UI = {
let inputFocus = "none";
if (e.detail.types.indexOf("username") === -1) {
document.getElementById("noVNC_username_block").classList.add("noVNC_hidden");
} else {
inputFocus = inputFocus === "none" &&
document.getElementById("noVNC_username_input").value === ""
? "noVNC_username_input" : inputFocus;
} else if (document.getElementById("noVNC_username_input").value === "") {
inputFocus = "noVNC_username_input";
}
if (e.detail.types.indexOf("password") === -1) {
document.getElementById("noVNC_password_block").classList.add("noVNC_hidden");
} else {
inputFocus = inputFocus === "none"
? "noVNC_password_input" : inputFocus;
} else if (inputFocus === "none") {
inputFocus = "noVNC_password_input";
}
document.getElementById('noVNC_credentials_dlg')
.classList.add('noVNC_open');