From 6197f57c436af7bafd5a1613e69db107b99d54c0 Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 9 Sep 2026 23:32:06 +0300 Subject: [PATCH] Fix trash: restore/perm delete buttons not working when clicking card content --- public/js/trash.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/trash.js b/public/js/trash.js index 1097941..d7bd63e 100644 --- a/public/js/trash.js +++ b/public/js/trash.js @@ -83,10 +83,12 @@ document.getElementById('emptyBtn').addEventListener('click', emptyTrash); document.getElementById('imgModal').addEventListener('click', e => e.currentTarget.classList.remove('open')); document.getElementById('grid').addEventListener('click', e => { - const rs = e.target.closest('[data-restore]'); - if (rs) { restoreEntry(parseInt(rs.dataset.restore, 10)); return; } - const hd = e.target.closest('[data-hard]'); - if (hd) { hardDelete(parseInt(hd.dataset.hard, 10)); } + const card = e.target.closest('.card'); + if (!card) return; + const rs = card.querySelector('[data-restore]'); + if (rs && (e.target === rs || rs.contains(e.target))) { restoreEntry(parseInt(rs.dataset.restore, 10)); return; } + const hd = card.querySelector('[data-hard]'); + if (hd && (e.target === hd || hd.contains(e.target))) { hardDelete(parseInt(hd.dataset.hard, 10)); } }); (async () => {