Auto-focus: loginUsername on load, website in add/edit modals. Enter saves from anywhere inside modals.
This commit is contained in:
@@ -460,6 +460,7 @@ function openAdd() {
|
||||
loadUsername();
|
||||
populateFolderSelects();
|
||||
document.getElementById('addModal').classList.add('show');
|
||||
document.getElementById('addSite').focus();
|
||||
playSound('open');
|
||||
}
|
||||
|
||||
@@ -1036,6 +1037,7 @@ function openEdit(id) {
|
||||
document.getElementById('editPassword').value = e.password;
|
||||
document.getElementById('editPassword').type = 'password';
|
||||
document.getElementById('editModal').classList.add('show');
|
||||
document.getElementById('editSite').focus();
|
||||
playSound('open');
|
||||
}
|
||||
function closeEdit() { document.getElementById('editModal').classList.remove('show'); playSound('close'); }
|
||||
@@ -1376,7 +1378,7 @@ document.addEventListener('mouseup', function(e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Enter' && !e.ctrlKey && !e.altKey && !e.metaKey) { const a = document.activeElement; const id = a && a.id; e.preventDefault(); if (id === 'addPassword' || id === 'addSite' || id === 'addUsername') addEntry(); else if (id === 'editPassword' || id === 'editSite' || id === 'editUsername') saveEdit(); else if (id === 'loginPassword') login(); else if (id === 'regPassword') register(); } });
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Enter' && !e.ctrlKey && !e.altKey && !e.metaKey) { const a = document.activeElement; if (!a || a.tagName === 'BUTTON') return; e.preventDefault(); if (document.getElementById('editModal').classList.contains('show') && a.closest('.edit-box')) saveEdit(); else if (document.getElementById('addModal').classList.contains('show') && a.closest('.modal-box')) addEntry(); else if (!document.getElementById('authSection').classList.contains('hidden')) { if (a.id === 'loginUsername' || a.id === 'loginPassword') login(); else if (a.id === 'regPassword') register(); } } });
|
||||
document.getElementById('genModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeGen(); });
|
||||
document.getElementById('editModal').addEventListener('click', e => { if (e.target === e.currentTarget) closeEdit(); });
|
||||
// ==================== KEYBOARD SHORTCUTS ====================
|
||||
@@ -1464,4 +1466,5 @@ document.addEventListener('keydown', function(e) {
|
||||
if (document.getElementById('addModal').classList.contains('show')) addEntry();
|
||||
else if (document.getElementById('editModal').classList.contains('show')) saveEdit();
|
||||
}
|
||||
});
|
||||
});
|
||||
document.getElementById('loginUsername').focus();
|
||||
Reference in New Issue
Block a user