From 6987efcc686a1e5e8e2973b42c19a02d35dd86e4 Mon Sep 17 00:00:00 2001 From: Felix Stubner Date: Tue, 18 Aug 2026 00:10:25 +0100 Subject: [PATCH] Make docs search respond to arrow keys, and the mobile menu opaque Two findings from the acceptance pass. 1. Arrow keys did nothing in the docs search. Pagefind's default UI leaves focus in the input and ignores ArrowDown/ArrowUp, so results were reachable only by tabbing. Tab and Enter did work, so search was usable -- but the down arrow is the key most people try first, and it appeared to do nothing at all. Focus moves for real rather than painting a highlight and tracking `aria-activedescendant`. The results are anchors, so focus gets Enter, middle-click and screen-reader announcement for free, and there is no second notion of "selected" to keep in sync with the rendered list. Results are re-queried on every keypress, because Pagefind re-renders the list as the query changes and any cached node would be stale. Down from the input enters the list; up from the first result returns to the input, so the query is one keypress away rather than Shift+Tab. Up from the input wraps to the last result. Verified on the deployed build: start -> INPUT Down -> result: Packet capture Down -> result: Packet capture Down -> result: CLI Capture Up -> result: Packet capture Up -> result: Packet capture Up -> INPUT 2. The mobile docs menu was see-through, and dark in light theme. The panel background was a hard-coded `rgba(27, 32, 40, 0.96)`, which failed twice over. The 4% let the page read through the open menu, with body text crossing the menu labels. And because the colour was hard-coded rather than tokenised, the panel stayed dark in light theme -- a dark drawer over a #fbfbfb page, with white showing through it. Now `var(--sl-color-bg-sidebar)`: #111 in dark, #fbfbfb in light, opaque in both. Measured after the fix, and the panel follows the theme. The same report noted the first sidebar group label sitting behind the breadcrumb bar. That does not reproduce now -- it was the breadcrumb showing *through* the translucent panel, so the opacity fix resolved it. Confirmed with elementFromPoint: the panel's own content is topmost across its full area. astro check clean, build passes, a11y 14 routes x both themes 0 violations, file-size guard clean. --- site/src/components/starlight/Header.astro | 2 + site/src/scripts/docs-search-keys.ts | 65 +++++++++++++++++++ .../starlight/20-docs-shell-closeout.css | 14 +++- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 site/src/scripts/docs-search-keys.ts diff --git a/site/src/components/starlight/Header.astro b/site/src/components/starlight/Header.astro index c0af7737..968c194a 100644 --- a/site/src/components/starlight/Header.astro +++ b/site/src/components/starlight/Header.astro @@ -59,7 +59,9 @@ const isActive = (href: string) => {