From 2271afac327f86908510a8d97a7830c26b99c3ac Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sat, 14 Nov 2026 21:28:03 -0700 Subject: [PATCH] Make every filter reachable, and one line each 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 --- web/assets/style.css | 29 +++++++++++++++++++++++------ web/olt/facets.py | 9 +++++++++ web/olt/home.py | 11 ++++++----- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/web/assets/style.css b/web/assets/style.css index 230caac..651e6d1 100644 --- a/web/assets/style.css +++ b/web/assets/style.css @@ -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 { diff --git a/web/olt/facets.py b/web/olt/facets.py index b5e010a..bb641ac 100644 --- a/web/olt/facets.py +++ b/web/olt/facets.py @@ -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", diff --git a/web/olt/home.py b/web/olt/home.py index 593082d..1e7e408 100644 --- a/web/olt/home.py +++ b/web/olt/home.py @@ -205,9 +205,10 @@ def _checks(name, items, c, prefix, hints=None): n = c[f"{prefix}:{value}"] if not n: continue - hint = f'{esc(hints[value])}' if hints and hints.get(value) else "" - out.append(f'') + # 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'') return "".join(out) @@ -265,7 +266,7 @@ def finder_form(records, c=None, steps=None): {facets.KIND}
- +

What is a route?

@@ -284,7 +285,7 @@ def finder_form(records, c=None, steps=None): """) more.append(f"""
{facets.GPX} - {_checks("gpx", facets.GPX_STATUS.items(), c, "gpx")} + {_checks("gpx", facets.GPX_FILTER.items(), c, "gpx")}
""") return f"""