Skip to content

Commit 0585922

Browse files
TMHSDigitalclaude
andcommitted
site: stop the filter panel sticking on small screens (batch E)
At 375x800 the wrapped filter panel was 527px tall and pinned while scrolling, leaving about 270px of an 800px screen for entries. On screens up to 640px wide or 600px tall it now scrolls away with the page; the Top button brings it back and focuses search. app.js publishes --sticky-h as 0 when the panel is not sticky, so permalinks and category jumps no longer reserve 527px of empty space above the target, and the category scroll-spy measures from the top of the viewport. Checked in touch emulation: entries get the full screen at 375x800 and 800x400; #entry- permalinks land 16px from the top; Top returns with search visible and focused. Desktop is unchanged (sticky, 228px). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wc67NX9MM964uaVGn4bpZJ
1 parent e3426a1 commit 0585922

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

‎site/public/app.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,14 @@
366366
const controls = $(".controls");
367367
// Anchored jumps (chip links, #entry- permalinks) would otherwise land
368368
// underneath the sticky filter bar. Its height varies with wrapping, so
369-
// publish the measured value and let CSS scroll-margin use it.
370-
if (controls) {
371-
document.documentElement.style.setProperty(
372-
"--sticky-h",
373-
`${Math.round(controls.getBoundingClientRect().height)}px`
374-
);
375-
}
376-
const cutoff = (controls ? controls.getBoundingClientRect().bottom : 0) + 8;
369+
// publish the measured value and let CSS scroll-margin use it. On small
370+
// screens the bar is not sticky, and nothing needs clearing.
371+
const stuck = !!controls && getComputedStyle(controls).position === "sticky";
372+
document.documentElement.style.setProperty(
373+
"--sticky-h",
374+
stuck ? `${Math.round(controls.getBoundingClientRect().height)}px` : "0px"
375+
);
376+
const cutoff = (stuck ? controls.getBoundingClientRect().bottom : 0) + 8;
377377
let found = null;
378378
for (const h of groupHeadings) {
379379
if (h.getBoundingClientRect().top <= cutoff) found = h.getAttribute("data-cat");

‎site/public/styles.css‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,17 @@ input:focus-visible {
10051005
}
10061006
}
10071007

1008+
/* On a phone the wrapped filter panel is about 530px tall, two thirds of the
1009+
screen, and pinning it left a strip for the entries. Small or short screens
1010+
scroll it away with the page instead; "Top" brings it back. */
1011+
@media (max-width: 640px), (max-height: 600px) {
1012+
.controls {
1013+
position: static;
1014+
}
1015+
}
1016+
10081017
/* Anchored targets must clear the sticky filter bar. app.js measures it into
1009-
--sticky-h; the fallback covers the no-JS page. */
1018+
--sticky-h (0 when it is not sticky); the fallback covers the no-JS page. */
10101019
.group-heading,
10111020
.entry-card {
10121021
scroll-margin-top: calc(var(--sticky-h, 10rem) + 1rem);

0 commit comments

Comments
 (0)