diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 0113cdfd17..26387f3494 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '066d4e1e6d183026098cafe5a312633e517b2031'; +const TRUSTED_SCRIPTS_TREE = '75a61a7ab6d25706d9ff889dfa082639336c9bfb'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/changelog.d/changed-activity-monitor-phone-12px-text-floor.md b/changelog.d/changed-activity-monitor-phone-12px-text-floor.md new file mode 100644 index 0000000000..4a0c3be377 --- /dev/null +++ b/changelog.d/changed-activity-monitor-phone-12px-text-floor.md @@ -0,0 +1 @@ +- Activity monitor text now has a 12px floor on phones, so the chips, timestamps and column headers stay readable at 390px wide. diff --git a/src/docs/dashboard-design-system.md b/src/docs/dashboard-design-system.md index daca06a0a2..f927dc9ae3 100644 --- a/src/docs/dashboard-design-system.md +++ b/src/docs/dashboard-design-system.md @@ -326,6 +326,17 @@ the focus trap and the body scroll lock behave as on desktop; desktop layout is unchanged apart from the affordance. Metrics come from the `--modal-scroll-*` / `--modal-sheet-*` tokens in `tokens.css`. +### Phone text floor for the Activity monitor + +Inside `#activity-monitor-section`, the phone tier +(`@media (max-width: 640px), ((pointer: coarse) and (max-width: 820px))` in +`responsive.css`) remaps `--fs-2xs` and `--fs-xs` to `--fs-sm` (`.75rem`, +12px), so no `.ham-*` text renders below 12px on a phone. Inputs stay at +`--fs-touch`. Desktop sizes are unchanged. New tracker CSS should size text +through `--fs-2xs`/`--fs-xs`/`--fs-sm` and never hard-code a smaller size, so +the floor applies automatically. `dashboard-mobile-shots.mjs` asserts it at +390×844 through the `tracker-text-floor` probe. + ### Phone tap targets: `--tap-target-touch` `--tap-target` (40px) sizes icon-only controls on desktop and the 768px tier. diff --git a/src/pkg/dashboard/activity_monitor_phone_text_floor_test.go b/src/pkg/dashboard/activity_monitor_phone_text_floor_test.go new file mode 100644 index 0000000000..8221055a69 --- /dev/null +++ b/src/pkg/dashboard/activity_monitor_phone_text_floor_test.go @@ -0,0 +1,40 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// TestActivityMonitorPhoneTextFloor guards the 12px phone text floor for the +// Activity monitor (#17164): the phone media tier must remap --fs-2xs and +// --fs-xs to --fs-sm inside #activity-monitor-section, plus --ham-odo-digit, +// which :root resolves from --fs-xs before the section override can apply. +func TestActivityMonitorPhoneTextFloor(t *testing.T) { + html := indexHTML(t) + + const tier = "@media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) {" + const rule = "#activity-monitor-section { --fs-2xs: var(--fs-sm); --fs-xs: var(--fs-sm); --ham-odo-digit: var(--fs-sm); }" + + found := false + for rest := html; ; { + i := strings.Index(rest, tier) + if i < 0 { + break + } + rest = rest[i+len(tier):] + end := strings.Index(rest, "\n }\n") + if end < 0 { + break + } + if strings.Contains(rest[:end], rule) { + found = true + break + } + } + if !found { + t.Errorf("phone media tier is missing %q — Activity monitor text must stay >= 12px on phones (#17164)", rule) + } + if !strings.Contains(html, "--fs-sm: .75rem;") { + t.Errorf("--fs-sm must remain .75rem (12px), the phone text floor (#17164)") + } +} diff --git a/src/pkg/dashboard/static-src/css/responsive.css b/src/pkg/dashboard/static-src/css/responsive.css index a295a1fb0b..8a7e3d8d40 100644 --- a/src/pkg/dashboard/static-src/css/responsive.css +++ b/src/pkg/dashboard/static-src/css/responsive.css @@ -41,6 +41,7 @@ .ham-compact .ham-chips { display: inline-flex; flex: 0 0 auto; } .ham-compact .ham-chip { flex: 0 0 auto; min-height: var(--tap-target); font-size: var(--fs-sm); white-space: nowrap; } .ham-compact-more[data-ham-active] { background: var(--panel-strong); color: var(--text); border-color: var(--line-strong); } + #activity-monitor-section { --fs-2xs: var(--fs-sm); --fs-xs: var(--fs-sm); --ham-odo-digit: var(--fs-sm); } } @media (max-width: 768px) { body { diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 80aa4cd510..c40d5016aa 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -989,6 +989,7 @@ dropped and the caption keeps its lead clause on one line. The pill sheet carries the full title and the needs-human note. */ @media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) { + #activity-monitor-section .ham-row { padding-block: var(--sp-3); } #activity-monitor-section .ham-row > .ham-row-head.ham-row-head, #activity-monitor-section .ham-sub > .ham-row-head.ham-row-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-2); row-gap: var(--sp-1); min-height: 0; line-height: var(--lh-control); } .ham-head-cols, .ham-head-cols > .ham-strip, .ham-head-cols .ham-seg.ham-head-lead, .ham-head-cols .ham-seg.ham-head-pr, .ham-head-cols .ham-pr-line { display: contents; } #activity-monitor-section .ham-row-head .ham-head-main, #activity-monitor-section .ham-row-head .ham-pr-ref { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; max-width: 100%; gap: 0; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f7de6f8899..59097c3e08 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2332,6 +2332,7 @@ dropped and the caption keeps its lead clause on one line. The pill sheet carries the full title and the needs-human note. */ @media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) { + #activity-monitor-section .ham-row { padding-block: var(--sp-3); } #activity-monitor-section .ham-row > .ham-row-head.ham-row-head, #activity-monitor-section .ham-sub > .ham-row-head.ham-row-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-2); row-gap: var(--sp-1); min-height: 0; line-height: var(--lh-control); } .ham-head-cols, .ham-head-cols > .ham-strip, .ham-head-cols .ham-seg.ham-head-lead, .ham-head-cols .ham-seg.ham-head-pr, .ham-head-cols .ham-pr-line { display: contents; } #activity-monitor-section .ham-row-head .ham-head-main, #activity-monitor-section .ham-row-head .ham-pr-ref { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; max-width: 100%; gap: 0; } @@ -6004,6 +6005,7 @@ .ham-compact .ham-chips { display: inline-flex; flex: 0 0 auto; } .ham-compact .ham-chip { flex: 0 0 auto; min-height: var(--tap-target); font-size: var(--fs-sm); white-space: nowrap; } .ham-compact-more[data-ham-active] { background: var(--panel-strong); color: var(--text); border-color: var(--line-strong); } + #activity-monitor-section { --fs-2xs: var(--fs-sm); --fs-xs: var(--fs-sm); --ham-odo-digit: var(--fs-sm); } } @media (max-width: 768px) { body { diff --git a/src/pkg/dashboard/webstatic/style_ratchet_test.go b/src/pkg/dashboard/webstatic/style_ratchet_test.go index 6304187f4f..d5bddf9ba7 100644 --- a/src/pkg/dashboard/webstatic/style_ratchet_test.go +++ b/src/pkg/dashboard/webstatic/style_ratchet_test.go @@ -27,7 +27,7 @@ type styleRatchetCounts struct { var styleRatchetBaselines = map[string]styleRatchetCounts{ "operator static/index.html": { inlineStyles: 1403, - rawColors: 135, + rawColors: 134, rawFontSizes: 591, rawPadding: 204, rawBorderRadii: 174}, diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-text-floor.js b/src/pkg/dashboard/webstatic/testdata/tracker-text-floor.js new file mode 100644 index 0000000000..41e2d0dff6 --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-text-floor.js @@ -0,0 +1,27 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// On phones every rendered text node in the Activity monitor must be >= 12px (#17164). +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const root = document.getElementById('activity-monitor-section'); + if (!root) throw new Error(JSON.stringify({ viewport: innerWidth, failures: ['#activity-monitor-section missing'] })); + const phone = innerWidth <= 640; + const failures = []; + const small = []; + let checked = 0; + const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT); + for (let node = walker.nextNode(); node; node = walker.nextNode()) { + if (!node.nodeValue.trim()) continue; + const el = node.parentElement; + const style = getComputedStyle(el); + if (style.display === 'none' || style.visibility === 'hidden' || !el.getClientRects().length) continue; + checked++; + if (parseFloat(style.fontSize) < 12) small.push(el.className + ' ' + style.fontSize); + } + if (phone) { + if (!checked) failures.push('no visible text nodes in the Activity monitor'); + if (small.length) failures.push(small.length + ' text nodes below 12px: ' + [...new Set(small)].slice(0, 10).join('; ')); + if (document.documentElement.scrollWidth > innerWidth) failures.push('horizontal overflow: scrollWidth ' + document.documentElement.scrollWidth + ' > ' + innerWidth); + } + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, checked, failures })); + return { viewport: innerWidth, checked, below12: small.length, failures }; +}) diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index 9d15695c68..479df0e681 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -267,7 +267,7 @@ async function main() { const activityFailures = []; const fixtureRoot = path.join(process.cwd(), 'src/pkg/dashboard/webstatic/testdata'); const density = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'tracker-activity-density.json'), 'utf8')); - const probes = ['tracker-header-geometry', 'tracker-decision-interaction', 'tracker-phone-chrome', 'tracker-phone-pill', 'tracker-phone-ergonomics', 'tracker-phone-card'].map(name => ({ + const probes = ['tracker-header-geometry', 'tracker-decision-interaction', 'tracker-phone-chrome', 'tracker-phone-pill', 'tracker-phone-ergonomics', 'tracker-phone-card', 'tracker-text-floor'].map(name => ({ name, source: fs.readFileSync(path.join(fixtureRoot, name + '.js'), 'utf8'), })); // Phone tier (hivecommons/hive#17160): the chevron strip is hidden behind