Skip to content

🐛 dashboard: keep Overview KPI tiles inside the phone viewport - #16602

Closed
clubanderson wants to merge 1 commit into
v5from
fix/mobile-overview-kpi-overflow
Closed

clubanderson wants to merge 1 commit into
v5from
fix/mobile-overview-kpi-overflow

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #16601

Root cause

On a 430px phone the spoke Overview panel's KPI tiles were laid out ~483px wide: sublines were clipped at the card edge, sparklines (width:100%) overflowed the tile, and the whole grid was wider than the viewport. Label/subline text rendered at 16px.

Measured with headless Chrome at a 430px viewport (old v6 image 3820712 and v5 HEAD d5013b7 behave identically; the "2 days ago" screenshot differed only because the pill was not shown/zoom):

before after
.overview-kpis width 483px 428px
.overview-kpi-stale nowrap, 483px wraps, start-aligned
subline 1 line, clipped wraps (h 20 → 37px)
label font 16px 13.1px (--fs-base)
subline font 16px 14.7px (--fs-md)
document scrollWidth 483 430

Change (static-src/css/overview.css, bundle regenerated via make dashboard-gen)

diff --git a/src/pkg/dashboard/static-src/css/overview.css b/src/pkg/dashboard/static-src/css/overview.css
index 1d1f94860..0d0fc45e6 100644
--- a/src/pkg/dashboard/static-src/css/overview.css
+++ b/src/pkg/dashboard/static-src/css/overview.css
@@ -13,23 +13,34 @@
     .overview-repo-filter { display: grid; gap: var(--sp-2); max-height: min(16rem, 32vh); overflow: auto; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); }
     .overview-settings-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
     .overview-headline { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); }
-    .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; }
+    /* Every headline child must be allowed to shrink to the card: the grid's
+       single auto track otherwise grows to the widest min-content child and
+       drags the KPI tiles past the phone viewport (hivecommons/hive#16601). */
+    .overview-headline > * { min-width: 0; max-width: 100%; }
+    .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; min-width: 0; }
     .overview-kpi-operator { display: inline-flex; align-items: center; justify-content: center; align-self: start; padding-top: var(--sp-3); color: var(--muted); font-size: var(--fs-lg); font-weight: 800; line-height: 1; }
     .overview-kpi-coverage-spacer { width: 1px; min-height: 100%; background: var(--border); opacity: 0.8; }
-    .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
+    .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; justify-self: start; white-space: normal; overflow-wrap: anywhere; }
     @media (max-width: 1399px) { .overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .overview-kpi-operator, .overview-kpi-coverage-spacer { display: none; } }
     @media (max-width: 720px) { .overview-kpis { grid-template-columns: minmax(0, 1fr); } }
     .overview-kpi-range { display: inline-flex; gap: var(--sp-1); }
     .overview-kpi-range-btn { min-width: 2rem; height: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; cursor: pointer; }
     .overview-kpi-range-btn.active { border-color: var(--accent); color: var(--accent); }
-    .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; cursor: pointer; }
+    .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; min-width: 0; cursor: pointer; }
     .overview-kpi:hover { border-color: var(--accent); }
     .overview-kpi-value { font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
     .overview-kpi-label { color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
-    .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; }
-    .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); }
-    .overview-kpi-spark .sparkline { width: 100%; }
-    .overview-kpi-spark svg { width: 100%; height: 24px; }
+    .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; overflow-wrap: anywhere; }
+    .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); min-width: 0; }
+    .overview-kpi-spark .sparkline { width: 100%; max-width: 100%; min-width: 0; }
+    .overview-kpi-spark svg { width: 100%; max-width: 100%; height: 24px; }
+    /* Phone tile type (hivecommons/hive#16601): --fs-2xs has no :root value, so
+       the label/subline above inherit the 16px body size and read as large as
+       the number on a phone. Pin them to defined tokens at this width. */
+    @media (max-width: 720px) {
+      .overview-kpi-label { font-size: var(--fs-base); }
+      .overview-kpi-subline { font-size: var(--fs-md); }
+    }
     .overview-kpi-coverage[data-coverage-state="success"] { --overview-coverage-color: var(--green); }
     .overview-kpi-coverage[data-coverage-state="warn"] { --overview-coverage-color: var(--yellow); }
     .overview-kpi-coverage[data-coverage-state="danger"] { --overview-coverage-color: var(--red); }
  • .overview-headline > * { min-width:0; max-width:100% }, .overview-kpis { min-width:0 }
  • .overview-kpi-stale: white-space: normal; overflow-wrap: anywhere; justify-self: start
  • .overview-kpi { min-width:0 }, .overview-kpi-subline { overflow-wrap: anywhere }
  • sparkline wrapper/svg: max-width:100%; min-width:0
  • @media (max-width:720px): label → --fs-base, subline → --fs-md (existing tokens; no raw font-size, style ratchet unchanged)

Desktop is unaffected except that a stale pill too long for the card now wraps instead of widening it.

Tests

  • cd src && go test ./pkg/dashboard/... -run 'Ratchet|Static|Snapshot|SharedAsset' ✅
  • node --test 'src/pkg/dashboard/**/*.test.js' — 302/302 ✅
  • make dashboard-gen-check ✅

The nowrap .overview-kpi-stale pill widened the single-column
.overview-headline grid past the viewport, so every KPI tile, subline
and sparkline was laid out at ~483px on a 430px phone and clipped.
Labels/sublines also used var(--fs-2xs), which has no :root value and
fell back to 16px.

Let the pill wrap inside the card, clamp headline children to the
track (min-width:0 / max-width:100%), wrap sublines, cap sparklines at
100%, and use --fs-base / --fs-md for label/subline at <=720px.

Fixes #16601

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 4, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 4, 2026
@clubanderson
clubanderson deleted the fix/mobile-overview-kpi-overflow branch November 4, 2026 14:04
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16600 ✨ Activity Monitor chevrons: active-with-text / icon-only spec, ring glyph, workflow-approval stall caption same files src/pkg/dashboard/static/index.html
#16514 ✨ feat(dashboard): replace Matrix presentation with Code activity same files src/pkg/dashboard/static/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overview KPI tiles overflow the phone viewport when the refresh/stale pill is shown

1 participant