Only focus username field if empty

https://github.com/novnc/noVNC/pull/2057
This commit is contained in:
dmotte 2026-05-22 20:07:04 +02:00 committed by GitHub
parent 4bce309c3b
commit 5c2025d5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

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