From 2ca2806ecef9c9727b7cbb34530e312fc555c92c Mon Sep 17 00:00:00 2001 From: MedMan Dev Date: Fri, 30 Oct 2026 16:17:48 +0000 Subject: Fix: don't reset scroll position when closing tag-assign dialogs closeModal now only restores S._scrollTop for file previews (S.ph set). Selection/rename dialogs keep the current scroll position instead of jumping back to the top. --- templates/index.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index 1b9cbe7..0099a88 100644 --- a/templates/index.html +++ b/templates/index.html @@ -978,11 +978,17 @@ document.getElementById('b-sel-clr').addEventListener('click',clearSel); function closeModal(){ _clearNavKd(); _clearPrefetch(); + const wasPreview = !!S.ph; document.getElementById('prev-modal').classList.remove('on'); S.ph=null; - requestAnimationFrame(()=>{ - document.getElementById('content').scrollTop=S._scrollTop||0; - }); + // Only restore the saved scroll position when closing a file preview. + // Selection/rename dialogs never move the scroll offset, so forcing + // S._scrollTop (which may be stale/0) would jump back to the top. + if(wasPreview){ + requestAnimationFrame(()=>{ + document.getElementById('content').scrollTop=S._scrollTop||0; + }); + } } document.getElementById('m-close').addEventListener('click',closeModal); document.getElementById('prev-modal').addEventListener('click',e=>{if(e.target===e.currentTarget)closeModal();}); -- cgit v1.2.3