fix: hide filter boxes and picker until wired

A filter box read "Filter Options41 rows" in the page text and the
file picker an empty "Setup Choose a setup": both do nothing without
the script. They are written hidden, keep their room so nothing moves,
and site.ts or the picker's script shows them. The count describes the
input and is spaced from the label. One box markup for the build and
the generator, and the Markdown copy skips hidden chrome.
This commit is contained in:
Abdessamad Derraz committed 2026-11-10 14:12:00 +01:00
1 parent fda6845289
commit c916503958
10 files changed
+65 -25

No files matched your search

+2 -8
View File
@@ -3818,14 +3818,8 @@ def _platform_file_list(rows: list[str], has_path: bool, anchor: str) -> list[st
"""
lines: list[str] = []
if len(rows) >= FILTER_ROWS:
field = f"rb-files-filter-{anchor}"
lines += [
'<div class="rb-table-filter">'
f'<label for="{field}">Filter files</label>'
f'<input id="{field}" type="search" autocomplete="off" placeholder="File, path, status, hash...">'
f'<span class="rb-table-filter-count" aria-live="polite">{len(rows):,} rows</span></div>',
"",
]
lines += [siteentries.filter_box(f"rb-files-filter-{anchor}", "files",
["File", "path", "status", "hash"], len(rows)), ""]
kind = "rb-files rb-files-path" if has_path else "rb-files"
return [*lines, f'<div class="{kind}">', *rows, "</div>"]
+4 -1
View File
@@ -123,7 +123,10 @@ class _Converter(HTMLParser):
self._emit(f"**{' '.join(name.split())}:**")
self._block()
return
if self.skip or tag in SKIPPED or attr.get("aria-hidden") == "true" \
# A `hidden` element is chrome the page's script shows (a filter
# box, the file picker, a setup's install chooser): a tab panel,
# hidden too, was read above.
if self.skip or tag in SKIPPED or attr.get("aria-hidden") == "true" or "hidden" in attr \
or classes & {"sr-only", "sl-anchor-link", "copy", "rb-anchor"}:
if tag not in ("br", "img", "hr", "input", "wbr"):
self.skip += 1
+13 -4
View File
@@ -47,12 +47,21 @@ def filter_placeholder(labels: list[str]) -> str:
def filter_box(ident: str, heading: str, labels: list[str], rows: int, noun: str = "rows") -> str:
"""The filter box rehype-stack-tables.mjs writes above a long table."""
"""The filter box rehype-stack-tables.mjs writes above a long table.
It is `hidden` until site.ts wires it: without the script it filters
nothing, so a reader with no JavaScript, a text dump and the search
skip it while the rows stay. retrobios.css keeps its room meanwhile,
so the table does not move when it shows. The count is the input's
description, and spaces keep label, field and count apart in any text
read from the HTML."""
return (
f'<div class="rb-table-filter"><label for="{ident}">Filter {html.escape(heading)}</label>'
f'<div class="rb-table-filter" hidden {markup.search_exclude()}>'
f'<label for="{ident}">Filter {html.escape(heading)}</label> '
f'<input id="{ident}" type="search" autocomplete="off" '
f'placeholder="{html.escape(filter_placeholder(labels))}">'
f'<span class="rb-table-filter-count" aria-live="polite">{rows:,} {noun}</span></div>'
f'placeholder="{html.escape(filter_placeholder(labels))}" aria-describedby="{ident}-count"> '
f'<span id="{ident}-count" class="rb-table-filter-count" aria-live="polite">'
f"{rows:,} {noun}</span></div>"
)