variable header size

This commit is contained in:
2026-07-02 22:24:01 +02:00
parent fe0adcf68e
commit b3cf5e4787
4 changed files with 336 additions and 10 deletions
+20
View File
@@ -14,6 +14,13 @@ const layout = ref(localStorage.getItem('layout') || 'list') // 'list' | 'cards'
let observer; // Declare observer outside the setup function
let initialLoad = false
// Set right before the scroll-position correction below, so AppNav's
// scroll-driven header compacting can tell "the page just moved because
// content was removed" apart from a real user scroll — otherwise every
// article marked read (which resets scrollY toward the top of the
// now-shorter list) would look identical to the user manually scrolling
// back to the top.
let scrollCorrectionPending = false
export function authHeaders() {
return {
@@ -265,6 +272,7 @@ function handleIntersection(entries, topbarHeight = 0) {
if (first) {
const top = first.getBoundingClientRect().top
if (top < topbarHeight) {
scrollCorrectionPending = true
window.scrollBy(0, top - topbarHeight)
}
}
@@ -272,6 +280,17 @@ function handleIntersection(entries, topbarHeight = 0) {
})
}
// Consume-once: returns whether a scroll-position correction is pending
// (and clears it), so a caller can tell this scroll event apart from a
// real user scroll without the flag lingering into later, unrelated ones.
function consumeScrollCorrection() {
if (scrollCorrectionPending) {
scrollCorrectionPending = false
return true
}
return false
}
function disconnectObserver() {
if (observer) {
observer.disconnect()
@@ -386,6 +405,7 @@ export function useFeeds() {
markAllRead,
showMessageForXSeconds,
setupIntersectionObserver,
consumeScrollCorrection,
disconnectObserver,
setInitialLoad,
handleIntersection,