diff options
| -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();}); |
