From f4a542885aa604ff55492f290d9cdd8471e14961 Mon Sep 17 00:00:00 2001 From: Zaki <18zaki18@gmail.com> Date: Sat, 9 May 2026 21:27:59 +0100 Subject: [PATCH] Enter key saves in add/edit modals from any field Pressing Enter in addSite, addUsername, passwordInput calls addEntry(). Enter in editSite, editUsername, editPassword calls saveEdit(). --- js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index c0780a8..a676b26 100644 --- a/js/app.js +++ b/js/app.js @@ -1376,7 +1376,7 @@ document.addEventListener('mouseup', function(e) { } } }); -document.addEventListener('keypress', e => { if (e.key === 'Enter') { if (document.getElementById('passwordInput') === document.activeElement) addEntry(); else if (document.getElementById('loginPassword') === document.activeElement) login(); else if (document.getElementById('regPassword') === document.activeElement) register(); } }); +document.addEventListener('keypress', e => { if (e.key === 'Enter') { const a = document.activeElement; const id = a && a.id; if (id === 'passwordInput' || 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.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 ====================