dashboard: sit the download glyph on the baseline instead of floating above it

The icon looked awkward next to REQUESTS: it floated a hair above the caps. The header aligns
its items on the text baseline, and an inline SVG's baseline is its box bottom, so the box
bottom was on the baseline -- but the tray bar was drawn at y 13.5 of a 16-unit viewBox,
leaving 1.7 units of empty space below it. The visible bar therefore sat above the baseline
while the letters sat on it.

Redrawn so the bar's stroke bottom lands exactly on the viewBox bottom (centreline 15.2 plus
half the 1.6 stroke = 16.0), which puts the bar on the baseline with no offset to tune. The
shaft and arrowhead moved up by the same amount to keep the proportions.

download.test.js gained a geometry guard that parses the viewBox, stroke width and bar
centreline out of the shipped markup and asserts the stroke bottom is flush with the box
bottom. Re-insetting the bar to the original 13.5 fails it with the measurement (14.3 want 16),
so a future edit that reintroduces the float is caught rather than eyeballed.

Verified: download 29 checks, history 29, extremes 27, poll_spark 35, dashboard_test 241 over
8 cases, sched_test 62646 over 184, no failures.

Not deployed. Goes to review with the separator and export commits.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
Memoria (Noblistic) authored and StillDeadcode committed 2026-11-03 18:09:49 +01:00
1 parent c36d04d99c
commit d537dc09aa
2 files changed
+14 -1

No files matched your search

+4 -1
View File
@@ -1238,7 +1238,10 @@ nav button.on { color:var(--fg); background:var(--track); }
<button type="button" class="pbtn" id="reqjson"
title="Download JSON file" aria-label="Download JSON file">
<svg width="12" height="12" viewBox="0 0 16 16" aria-hidden="true">
<path d="M8 1.5v8m0 0L4.6 6.1M8 9.5l3.4-3.4M2.2 13.5h11.6"
<!-- The tray bar's stroke bottom lands exactly on the viewBox
bottom, so baseline alignment puts the bar on the text
baseline. An inset bar floats a hair above the caps. -->
<path d="M8 2v9m0 0L4.6 7.6M8 11l3.4-3.4M2.2 15.2h11.6"
fill="none" stroke="currentColor" stroke-width="1.6"
stroke-linecap="round" stroke-linejoin="round"/>
</svg></button></span>
+10
View File
@@ -24,6 +24,16 @@ ok(/title="Download JSON file"/.test(btn), "the tooltip says 'Download JSON file
ok(/aria-label="Download JSON file"/.test(btn), "and is labelled for assistive tech");
ok(/<svg[\s\S]*<\/svg>/.test(btn), "it holds an icon, not a text label");
ok(!/>\s*json\s*</.test(btn), "no leftover 'json' text label inside the button");
/* The glyph must sit ON the baseline, not float above it. The header aligns items on the text
baseline, and an inline SVG's baseline is its box bottom -- so the tray bar's STROKE bottom
has to land on the viewBox bottom. An inset bar (the original sat at 13.5 of 16) leaves dead
space below it and the icon floats a hair above the caps, which is what this replaced. */
const vb = +(btn.match(/viewBox="0 0 ([\d.]+) ([\d.]+)"/) || [, , 0])[2];
const sw = +(btn.match(/stroke-width="([\d.]+)"/) || [, 0])[1];
const bar = +(btn.match(/M[\d.]+ ([\d.]+)h/) || [, 0])[1];
ok(vb > 0 && sw > 0 && bar > 0, "parsed the glyph geometry (viewBox " + vb + ", stroke " + sw + ", bar " + bar + ")");
eq(Math.round((bar + sw / 2) * 1000) / 1000, vb,
"the tray bar's stroke bottom is flush with the box bottom, so it sits on the baseline");
/* It must sit in the Requests header, in the LEFT group, before the right-hand aside. Index
ordering is sturdier than a regex across the whole block. */
const iLeft = page.indexOf('class="pleft"');