From de0a4e5decbb966f34552b8c90efd1dc4d2066b5 Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Wed, 7 Jan 2026 11:34:55 +0800 Subject: [PATCH] Fix modal close outside click on drag. --- index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 87f03aa..fe00759 100644 --- a/index.html +++ b/index.html @@ -2423,6 +2423,12 @@ chmod 755 kbtd return false; } + let modalMousedownTarget = null; + + document.addEventListener('mousedown', (e) => { + modalMousedownTarget = e.target; + }); + document.addEventListener('click', (e) => { if (!e.target.closest('.card-menu') && !e.target.closest('.card-menu-btn')) { closeAllCardMenus(); @@ -2433,12 +2439,13 @@ chmod 755 kbtd if (!e.target.closest('.project-select-dropdown') && !e.target.closest('#project-select-btn')) { closeProjectDropdown(); } - if (e.target.id === 'about-modal') { + if (e.target.id === 'about-modal' && modalMousedownTarget && modalMousedownTarget.id === 'about-modal') { aboutModal.close(); } - if (e.target.id === 'card-detail-modal') { + if (e.target.id === 'card-detail-modal' && modalMousedownTarget && modalMousedownTarget.id === 'card-detail-modal') { cardDetailModal.close(); } + modalMousedownTarget = null; }); $('#card-detail-title-input').addEventListener('input', updateCardDetailButtons);