Fix immersive reader: extend top zone to cover visible bar heights
All checks were successful
Build and push Docker image / build (push) Successful in 13s
Test / test (push) Successful in 16s

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 <noreply@anthropic.com>
This commit is contained in:
marwin 2026-03-21 19:01:37 +01:00
parent 0037fd8db4
commit ee8cfd8314

View file

@ -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);