From 3cb3463365abf25d26f77099a204de6a90793d75 Mon Sep 17 00:00:00 2001 From: dmotte <37443982+dmotte@users.noreply.github.com> Date: Fri, 22 May 2026 19:10:08 +0200 Subject: [PATCH] Make credentials input focus logic easier to read --- app/ui.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/ui.js b/app/ui.js index 72448a5e..df046d20 100644 --- a/app/ui.js +++ b/app/ui.js @@ -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');