Skip to content

Commit 7be41d6

Browse files
committed
dashboard: an out-link label may wrap — the last nowrap that broke the phone
The board family's shared theme now makes wrapping the page default (PyAutoBrain#266) and bounds its chips (PyAutoBrain#270). `white-space:nowrap` is the one thing an inherited `overflow-wrap` cannot reach, and this file has two of them. One is fed by data. `a.out` labels are built from repo names — `f"{name} run"` for a failing row, `f"{repo} {kind}"` for a hang event — and this org's longest repo name is 36 characters. Under `nowrap` that is a single unbreakable ~500px word, which sets the summary column's min-content width and takes the whole page with it. Rendered with a failing row whose link names that repo and measured in a headless Chromium: a 375px viewport scrolled to 521px, with the summary text and the details list dragged off the edge alongside the link. Dropping `nowrap` costs nothing. A short label like `run ↗` has no wrap opportunity to take, so it is unaffected; a long one now breaks instead of breaking the page, and the shared theme's `overflow-wrap` does the rest. Re-measured: 375/375 at a 390px viewport, 305/305 at 320px. `td.name` keeps its `nowrap`: those titles come from this module's own fixed vocabulary ("Libraries", "Workspace test-mode timing"), never from repo data, so it carries no such trap. 603 tests pass, including one pinning the link label. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VhpLPmmoSFAtVpppG8azVA
1 parent 2ccefe3 commit 7be41d6

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

heart/dashboard.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,15 @@ def _html_reason(item: dict) -> str:
12841284
ul.det{margin:.35rem 0 0;padding-left:1.1rem;color:var(--muted);
12851285
font-size:.85rem}
12861286
.ago{color:var(--muted)}
1287-
a.out{font-size:.85rem;white-space:nowrap}
1287+
/* The out-links carry DATA in their labels — `<repo> run`, and this org's
1288+
longest repo name is 36 characters. `nowrap` made one of those a single
1289+
unbreakable 500px word, which set the summary column's min-content width
1290+
and pushed the whole page sideways on a phone (measured: a 375px viewport
1291+
scrolling to 521px). Nothing is lost by letting them wrap: a short label
1292+
like `run ↗` has no wrap opportunity to take, and a long one should break
1293+
rather than break the page. The shared theme's `overflow-wrap` does the
1294+
rest. */
1295+
a.out{font-size:.85rem}
12881296
.stale{background:var(--btn);border:1px solid var(--warn);color:var(--warn);
12891297
padding:.55rem .75rem;border-radius:8px}
12901298
.reasons{margin:1.5rem 0}

tests/test_dashboard.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,3 +840,18 @@ def test_html_wears_the_shared_family_theme():
840840
assert t.ORGANS[dashboard.BOARD_KEY]["tagline"] in out
841841
assert t.ORGANS[dashboard.BOARD_KEY]["ink_dark"] in out
842842
assert "#58a6ff" not in out # the old hard-coded GitHub blue
843+
844+
845+
def test_a_long_out_link_label_cannot_push_the_page_sideways():
846+
"""The out-links carry DATA in their labels (`<repo> run`), and this org's
847+
longest repo name is 36 characters. Under `white-space:nowrap` that was a
848+
single unbreakable ~500px word: it set the summary column's min-content
849+
width and scrolled the whole board sideways on a phone (a 375px viewport
850+
measured 521px). Short labels have no wrap opportunity to take, so nothing
851+
is lost by letting them break."""
852+
out = dashboard.render(
853+
_failing_snapshot() if "_failing_snapshot" in globals() else make_snapshot(),
854+
make_verdict("red", 40, red_reasons=["RepoA: CI failure"]),
855+
fmt="html", now=FRESH_NOW)
856+
rule = re.search(r"a\.out\{[^}]*\}", out).group(0)
857+
assert "nowrap" not in rule

0 commit comments

Comments
 (0)