From ee8cfd8314392a808043b28a2f14c9564507d6bd Mon Sep 17 00:00:00 2001 From: marwin Date: Sat, 21 Mar 2026 19:01:37 +0100 Subject: [PATCH] Fix immersive reader: extend top zone to cover visible bar heights When top bars are showing, use their actual combined offsetHeight (+12px buffer) as the hide threshold instead of the fixed 60px. This prevents the bars from disappearing while the mouse moves from the edge zone down to click header buttons. Co-Authored-By: Claude Sonnet 4.6 --- static/js/app.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index a49e780..32bdeee 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2924,8 +2924,17 @@ const _IMM_DELAY = 5000; const _IMM_EDGE = 60; // px from top/bottom edge function _immMouseMove(e) { - const atTop = e.clientY < _IMM_EDGE; - const atBottom = e.clientY > window.innerHeight - _IMM_EDGE; + // When bars are already showing, extend threshold to cover their actual height + const topThreshold = _immTopShowing + ? (document.querySelector('.navbar')?.offsetHeight ?? 0) + + (document.querySelector('.reader-header')?.offsetHeight ?? 0) + 12 + : _IMM_EDGE; + const bottomThreshold = _immBottomShowing + ? (document.querySelector('.now-playing-bar')?.offsetHeight ?? 0) + 12 + : _IMM_EDGE; + + const atTop = e.clientY < topThreshold; + const atBottom = e.clientY > window.innerHeight - bottomThreshold; if (atTop !== _immTopShowing) { _immTopShowing = atTop; document.body.classList.toggle('reader-show-top', atTop);