diff --git a/js/app.js b/js/app.js index 7aaeecc..9fa70ce 100644 --- a/js/app.js +++ b/js/app.js @@ -1409,6 +1409,30 @@ document.addEventListener('keydown', function(e) { return; } + // Arrow up/down — navigate entries in vault + if ((e.key === 'ArrowUp' || e.key === 'ArrowDown') && !isInput && document.getElementById('authSection').classList.contains('hidden')) { + e.preventDefault(); + const filtered = getFilteredEntries(); + if (!filtered.length) return; + let idx = -1; + if (selectedIds.size > 0) { + const firstId = [...selectedIds][0]; + idx = filtered.findIndex(e => e.id == firstId); + } + if (e.key === 'ArrowDown') idx = idx < filtered.length - 1 ? idx + 1 : 0; + else idx = idx > 0 ? idx - 1 : filtered.length - 1; + selectedIds.clear(); selectedIds.add(filtered[idx].id); + updateBatchBar(); render(); playSound('click'); + return; + } + + // Enter — open edit for single selected entry + if (e.key === 'Enter' && !isInput && selectedIds.size === 1 && document.getElementById('authSection').classList.contains('hidden') && !document.getElementById('editModal').classList.contains('show') && !document.getElementById('addModal').classList.contains('show')) { + e.preventDefault(); + openEdit([...selectedIds][0]); + return; + } + // ? or / to show shortcuts help (only in vault) if ((e.key === '?' || e.key === '/') && !isInput) { if (!document.getElementById('authSection').classList.contains('hidden')) return;