Make every filter reachable, and one line each
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s

The filter panel beside the trail list stuck to the top of the window
only on tall windows, and once "More filters" made it taller than the
window its lower half could not be reached until the page ran out of
trails. It now stays beside the list at any window height and is never
taller than the window: when its fields do not fit, the panel scrolls
on its own, with "Clear search and filters" kept at its foot.

The extra filters were set in two columns inside that narrow panel at
some window widths, which wrapped every choice. Beside the list they
are now one column, and each choice is one line with its count on the
right. The GPX choices have shorter names, the Walking descriptions
moved to a tooltip, and Kind reads "Official (131)".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-14 21:28:03 -07:00
1 parent 19fabadd49
commit 2271afac32
3 files changed
+38 -11

No files matched your search

+23 -6
View File
@@ -810,10 +810,21 @@ body:has(.hero--home) .site-header .wordmark { visibility: hidden; }
grid-template-columns: 18rem minmax(0, 1fr);
}
}
/* Sticky only when the viewport can hold the whole form, so no part of it is
trapped in a nested scroll box or cut off below the fold. */
@media (min-width: 64rem) and (min-height: 70rem) {
.filters { position: sticky; inset-block-start: var(--space-4); align-self: start; }
/* Beside the list, the filters stay on screen while the list scrolls. The panel
is never taller than the window: when its fields do not fit (a short window,
or "More filters" opened) it scrolls on its own, so every filter can be
reached from anywhere in the list. Its reset button stays at its foot. */
@media (min-width: 64rem) {
.filters {
position: sticky; inset-block-start: var(--space-4); align-self: start;
max-block-size: calc(100vh - 2 * var(--space-4));
max-block-size: calc(100dvh - 2 * var(--space-4));
overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.filters .filters__reset {
position: sticky; inset-block-end: 0; z-index: 1;
background: var(--surface); border-block-start: 1px solid var(--rule-strong);
}
}
/* Filters: search always shown; the rest folds away on narrow screens */
@@ -858,7 +869,9 @@ body:has(.hero--home) .site-header .wordmark { visibility: hidden; }
text-transform: none;
}
.filters__form { display: grid; gap: var(--space-4); padding: var(--space-4); }
@media (min-width: 40rem) and (max-width: 69.99rem) {
/* Two columns only while the filters sit above the list at full width; beside
the list the panel is narrow and every filter is one column. */
@media (min-width: 40rem) and (max-width: 63.99rem) {
.filters__form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters__form .field--wide { grid-column: 1 / -1; }
}
@@ -914,7 +927,11 @@ body:has(.hero--home) .site-header .wordmark { visibility: hidden; }
.check input { inline-size: 1.125rem; block-size: 1.125rem; margin: 0.15rem 0 0; accent-color: var(--trail); cursor: pointer; }
.check__text { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font: 500 var(--step-0)/1.35 var(--font-sans); }
.check__count { color: var(--ink-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.check__hint { grid-column: 2; color: var(--ink-2); font: 400 var(--step--1)/1.4 var(--font-sans); }
/* In the filter lists a choice is one line: its name on the left, its count on the right. */
.filters__form .check { padding-block: 0.3rem; align-items: center; }
.filters__form .check input { margin: 0; }
.filters__form .check__text { flex-wrap: nowrap; justify-content: space-between; }
.filters__form .check__count { flex: none; }
/* Results head */
.results-head {
+9
View File
@@ -249,6 +249,15 @@ def is_national(rec):
# GPX ------------------------------------------------------------------------
# The same six, as short as a filter row needs: one line each beside its count.
GPX_FILTER = {
"here": "GPX here",
"partial": "Partial GPX here",
"free": "Free from the author",
"sold": "Sold by the author",
"unpublished": "Not published",
"elsewhere": "On the official site",
}
GPX_STATUS = {
"here": "GPX to download here",
"partial": "Partial GPX to download here",
+6 -5
View File
@@ -205,9 +205,10 @@ def _checks(name, items, c, prefix, hints=None):
n = c[f"{prefix}:{value}"]
if not n:
continue
hint = f'<span class="check__hint">{esc(hints[value])}</span>' if hints and hints.get(value) else ""
out.append(f'<label class="check"><input type="checkbox" name="{name}" value="{esc(value)}">'
f'<span class="check__text">{esc(label)} <span class="check__count">{n}</span></span>{hint}</label>')
# A hint is a tooltip, not a second line: the row stays one line.
title = f' title="{esc(hints[value])}"' if hints and hints.get(value) else ""
out.append(f'<label class="check"{title}><input type="checkbox" name="{name}" value="{esc(value)}">'
f'<span class="check__text">{esc(label)} <span class="check__count">{n}</span></span></label>')
return "".join(out)
@@ -265,7 +266,7 @@ def finder_form(records, c=None, steps=None):
<legend>{facets.KIND}</legend>
<div class="seg">
<label><input type="radio" name="kind" value="" checked><span>Any</span></label>
<label><input type="radio" name="kind" value="trail"><span>Official trails ({c["kind:trail"]})</span></label>
<label><input type="radio" name="kind" value="trail"><span>Official ({c["kind:trail"]})</span></label>
<label><input type="radio" name="kind" value="route"><span>Routes ({c["kind:route"]})</span></label>
</div>
<p class="field__hint"><a href="/routes/">What is a route?</a></p>
@@ -284,7 +285,7 @@ def finder_form(records, c=None, steps=None):
</fieldset>""")
more.append(f"""<fieldset class="field">
<legend>{facets.GPX}</legend>
{_checks("gpx", facets.GPX_STATUS.items(), c, "gpx")}
{_checks("gpx", facets.GPX_FILTER.items(), c, "gpx")}
</fieldset>""")
return f"""<form class="filters" id="finder-form" role="search" aria-label="Find a trail">
<div class="filters__search field">