diff options
| author | MedMan Dev <dev@medman.local> | 2026-10-30 16:17:48 +0000 |
|---|---|---|
| committer | MedMan Dev <dev@medman.local> | 2026-10-30 16:17:48 +0000 |
| commit | 2ca2806ecef9c9727b7cbb34530e312fc555c92c (patch) | |
| tree | ca73625855a23d04189bb23ffe498271ad79ce02 | |
| parent | ec5f9cf92d6553d8b80b313ef0628e44759dce8b (diff) | |
| download | medman-2ca2806ecef9c9727b7cbb34530e312fc555c92c.tar.gz | |
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.
| -rw-r--r-- | templates/index.html | 12 |
1 files 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();}); |
