Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/integration-governance.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 'c6b5ba0094fcd1304b391315b196b44f4cc77633';
const TRUSTED_SCRIPTS_TREE = '6067449abe5556e11068e2901a222a45c03fe1d2';
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()) =>
Expand Down
1 change: 1 addition & 0 deletions changelog.d/added-activity-monitor-phone-tap-targets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity monitor on a phone: every control meets the 44px coarse-pointer floor (`--tap-target-touch`), the per-row select / ⋯ controls move from the hidden left gutter into the row header, and the ⋯ menu opens as a full-screen sheet with tap-sized items.
16 changes: 16 additions & 0 deletions src/docs/dashboard-design-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,22 @@ 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 tap targets: `--tap-target-touch`

`--tap-target` (40px) sizes icon-only controls on desktop and the 768px tier.
Phone tiers that must meet the Apple HIG / WCAG 2.5.5 coarse-pointer floor
remap it for their subtree to `--tap-target-touch` (44px, `base.css`) rather
than hard-coding sizes: the activity monitor does this in the
`.modal-sheet` phone query, so its chips, selects, search box, Merged /
queue chips, label chips, ⧉ ⛶ 📺 header tools, grip, ?, ⚙ and the per-row
select / ⋯ controls all grow together. The row controls leave the
hover-revealed left gutter for the top-right corner of the row header and
the ⋯ menu opens as a `.hive-dialog.modal-sheet` (`stageTrackerOpenSheet`,
`tracker-actions.js`) with tap-sized items. Inline text links (issue / PR
refs, prose anchors) are the one documented exclusion. The gate is
`webstatic/testdata/tracker-phone-ergonomics.js`, run by
`dashboard-mobile-shots.mjs` at 390×844.

## Ratchet plan

`pkg/dashboard/webstatic/style_ratchet_test.go`, modeled on
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/static-src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
into a circle several times its glyph. */
--tap-target: 40px;
--tap-glyph: 16px;
/* Coarse-pointer floor (Apple HIG / WCAG 2.5.5: 44pt). Phone tiers
that must meet it remap --tap-target to this for their subtree. */
--tap-target-touch: 44px;
--tap-ring: 28px;
/* Terminal surface — terminals always read as terminals: near-black
in dark mode, deep neutral (never white) in light mode. The
Expand Down
37 changes: 37 additions & 0 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -1065,3 +1065,40 @@
.sts-sample { padding: var(--sp-3) var(--sp-2) 0; }
.sts-sample .ham-row { padding: var(--sp-2); }
.sts-sample .ham-cols { padding-top: 0; }
/* Phone ergonomics (#17163, part of #17158): in the .modal-sheet tier
(the query responsive.css uses for full-screen dialogs) every control
in the activity monitor meets the coarse-pointer floor. --tap-target is
remapped to --tap-target-touch for this section only, so the grip, ?,
⚙ and the ⧉ ⛶ 📺 header tools (responsive.css sizes them from the same
token) grow with the chips, selects, search box, Merged / queue chips
and label chips. The select checkbox and ⋯ kebab leave the left gutter
(12px wide on touch, hover-revealed on desktop) for the top-right
corner of the row header, always visible and tap-sized; the header
reserves their width so the title wraps beside them. The kebab menu
itself is a .hive-dialog.modal-sheet (tracker-actions.js adds
.ham-menu-sheet) with tap-sized items and the sheet's safe-area pad.
Desktop (and the popout, kiosk, TV / display modes at desktop widths)
does not match the query and is unchanged. Tokens only (ADR-0018). */
@media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) {
#activity-monitor-section { --tap-target: var(--tap-target-touch); }
#activity-monitor-section .ham-toolbar .ham-chip, #activity-monitor-section .ham-labels .ham-chip, #activity-monitor-section .ham-selbar .ham-chip, #activity-monitor-section .ham-compact .ham-chip,
#activity-monitor-section .ham-select, #activity-monitor-section .ham-input,
#activity-monitor-section .ham-merged-count, #activity-monitor-section .ham-queue-chip,
#activity-monitor-section .ham-repo-chip, #activity-monitor-section .cue-event-ico, #activity-monitor-section .ham-lead-act, #activity-monitor-section .ham-badge-mod[data-action] {
box-sizing: border-box; min-height: var(--tap-target); min-width: var(--tap-target);
}
#activity-monitor-section .ham-toolbar .ham-chip, #activity-monitor-section .ham-labels .ham-chip, #activity-monitor-section .ham-selbar .ham-chip, #activity-monitor-section .ham-repo-chip, #activity-monitor-section .ham-lead-act { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
#activity-monitor-section .ham-select, #activity-monitor-section .ham-input { height: var(--tap-target); padding-top: 0; padding-bottom: 0; }
#activity-monitor-section .ham-repo-filter { min-height: var(--tap-target); align-items: center; }
#activity-monitor-section .ham-header-tool { width: var(--tap-target); min-width: var(--tap-target); height: var(--tap-target); min-height: var(--tap-target); padding: 0; font-size: var(--tap-glyph); }
#activity-monitor-panel { padding-left: 0; }
#activity-monitor-section .ham-row > .ham-row-tools, #activity-monitor-section .ham-sub > .ham-row-tools { left: auto; right: 0; top: 0; width: auto; flex-direction: row; align-items: flex-start; gap: var(--sp-2); z-index: 1; }
#activity-monitor-section .ham-row > .ham-row-head, #activity-monitor-section .ham-sub > .ham-row-head { padding-right: calc(2 * var(--tap-target) + var(--sp-2) + var(--sp-3)); min-height: var(--tap-target); }
#activity-monitor-section .ham-sel, #activity-monitor-section .ham-kebab { width: var(--tap-target); height: var(--tap-target); min-width: var(--tap-target); min-height: var(--tap-target); font-size: var(--tap-glyph); opacity: 1; }
.ham-menu.ham-menu-sheet { position: static; min-width: 0; max-width: none; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: var(--fs-touch); }
.ham-menu-sheet .ham-menu-head { display: none; }
.ham-menu-sheet .ham-menu-item { min-height: var(--tap-target-touch); padding: var(--sp-3) var(--sp-4); white-space: normal; overflow-wrap: anywhere; }
.ham-menu-sheet .ham-menu-hint, .ham-menu-sheet .ham-menu-note { font-size: var(--fs-sm); }
.ham-menu-sheet .ham-menu-sep { margin: var(--sp-2) 0; }
.ham-sheet .ham-sheet-body { padding-bottom: var(--safe-area-bottom); }
}
60 changes: 49 additions & 11 deletions src/pkg/dashboard/static-src/js/tracker-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,32 @@
document.removeEventListener('keydown', m.onKey, true);
window.removeEventListener('resize', m.onAway);
window.removeEventListener('scroll', m.onAway, true);
if (m.el.parentNode) m.el.parentNode.removeChild(m.el);
const host = m.host || m.el;
if (host.hiveDialogClose) host.hiveDialogClose(); else if (host.parentNode) host.parentNode.removeChild(host);
if (refocus && m.restore && typeof m.restore.focus === 'function' && document.contains(m.restore)) m.restore.focus();
}
// The phone tier of the dashboard's .modal-sheet (responsive.css): on a
// phone the row menu and the Merged / queue popovers open as full-screen
// sheets instead of anchored popovers. One query, shared with the CSS.
const STAGE_TRACKER_SHEET_QUERY = '(max-width: 640px), ((pointer: coarse) and (max-width: 820px))';
function stageTrackerIsPhoneSheet() {
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && !!window.matchMedia(STAGE_TRACKER_SHEET_QUERY).matches;
}
// Wrap `body` in a .hive-dialog.modal-sheet overlay (Esc / ✕ / backdrop
// close via hiveWireDialog; safe-area pad from the shared sheet CSS) and
// return the overlay. `onClose` runs once, however the sheet was closed;
// `onEnter` runs for Enter on a focused control inside the body.
function stageTrackerOpenSheet(title, body, cls, onClose, onEnter) {
const overlay = document.createElement('div');
overlay.className = 'hive-dialog-overlay';
if (typeof hiveRememberModalOpen === 'function') hiveRememberModalOpen(overlay);
const id = 'ham-sheet-' + Math.random().toString(36).slice(2);
overlay.innerHTML = `<div class="hive-dialog ham-sheet ${esc(cls || '')}" role="dialog" aria-modal="true" aria-labelledby="${id}"><div id="${id}" class="hive-dialog-title">${esc(title)}</div><div class="modal-scroll ham-sheet-body"></div></div>`;
overlay.querySelector('.ham-sheet-body').appendChild(body);
document.body.appendChild(overlay);
hiveWireDialog(overlay, () => { if (typeof onClose === 'function') onClose(); }, null, null, null, () => { if (typeof onEnter === 'function') onEnter(); });
return overlay;
}
// Open the menu for `items` at (x, y) — or below `anchor` — and run the
// picked action on them.
// Pure: does the menu (or one of its submenus) offer an enabled Let hive decide.
Expand All @@ -825,13 +848,26 @@
const tpl = document.createElement('template');
tpl.innerHTML = stageTrackerMenuHtml(actions, head);
const el = tpl.content.firstElementChild;
document.body.appendChild(el);
let x = at.x, y = at.y;
if (at.anchor && typeof at.anchor.getBoundingClientRect === 'function') { const r = at.anchor.getBoundingClientRect(); x = r.left; y = r.bottom; }
const pos = stageTrackerMenuPosition(x, y, el.offsetWidth, el.offsetHeight, window.innerWidth, window.innerHeight);
el.style.setProperty('left', pos.left + 'px');
el.style.setProperty('top', pos.top + 'px');
// On a phone the menu is a full-screen sheet (#17163): the fixed
// popover's ~30px items are too small to tap and it can land under
// the thumb. Same markup, roles and keyboard model; the sheet adds ✕,
// backdrop and Esc via the shared dialog wiring.
const sheet = stageTrackerIsPhoneSheet();
const m = { el, items, restore: at.restore || at.anchor || null };
if (sheet) {
el.classList.add('ham-menu-sheet');
m.host = stageTrackerOpenSheet(head, el, 'ham-menu-dialog', () => stageTrackerCloseMenu(true), () => {
const b = document.activeElement && document.activeElement.closest ? document.activeElement.closest('[role="menuitem"]') : null;
if (b && el.contains(b)) b.click();
});
} else {
document.body.appendChild(el);
let x = at.x, y = at.y;
if (at.anchor && typeof at.anchor.getBoundingClientRect === 'function') { const r = at.anchor.getBoundingClientRect(); x = r.left; y = r.bottom; }
const pos = stageTrackerMenuPosition(x, y, el.offsetWidth, el.offsetHeight, window.innerWidth, window.innerHeight);
el.style.setProperty('left', pos.left + 'px');
el.style.setProperty('top', pos.top + 'px');
}
m.onAway = e => { if (e.type !== 'pointerdown' || !el.contains(e.target)) stageTrackerCloseMenu(false); };
m.onKey = e => {
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); stageTrackerCloseMenu(true); return; }
Expand All @@ -844,7 +880,7 @@
case 'End': e.preventDefault(); stageTrackerMenuFocus(el, 'last'); break;
case 'ArrowRight': if (b && b.getAttribute('aria-haspopup') === 'menu' && b.getAttribute('aria-disabled') !== 'true') { e.preventDefault(); b.setAttribute('aria-expanded', 'true'); stageTrackerMenuFocus(el, 1, b); } break;
case 'ArrowLeft': { const sub = b && b.closest('.ham-submenu'); if (sub && sub.previousElementSibling) { e.preventDefault(); sub.previousElementSibling.setAttribute('aria-expanded', 'false'); sub.previousElementSibling.focus(); } break; }
case 'Tab': stageTrackerCloseMenu(true); break;
case 'Tab': if (!sheet) stageTrackerCloseMenu(true); break;
}
};
el.addEventListener('click', e => {
Expand All @@ -861,10 +897,12 @@
stageTrackerCloseMenu(true);
stageTrackerDoAction(m.items, act);
});
document.addEventListener('pointerdown', m.onAway, true);
if (!sheet) {
document.addEventListener('pointerdown', m.onAway, true);
window.addEventListener('resize', m.onAway);
window.addEventListener('scroll', m.onAway, true);
}
document.addEventListener('keydown', m.onKey, true);
window.addEventListener('resize', m.onAway);
window.addEventListener('scroll', m.onAway, true);
_stageTrackerMenu = m;
stageTrackerSetMenuOpen(document.getElementById('activity-monitor-panel'), true);
if (at.expandDecide) { const d = el.querySelector('[data-ham-act="decide"]'); if (d && d.getAttribute('aria-disabled') !== 'true') d.setAttribute('aria-expanded', 'true'); }
Expand Down
7 changes: 5 additions & 2 deletions src/pkg/dashboard/static-src/js/tracker-merged.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,13 @@
}
function stageTrackerTerminalView(d, nowMs) {
if (!d || !Array.isArray(d.items)) return d;
// Merge state is null until its first fetch lands; a row menu can be
// opened before then, so read it as "nothing merged yet".
const merged = _stageTrackerMergeState || {};
const items = d.items.map(item => {
const rowKey = stageTrackerItemKey(item), pin = _stageTrackerCelebrating[rowKey];
const active = pin && pin.until > nowMs;
if (item.kind === 'pr' && _stageTrackerMergeState[rowKey] === true) {
if (item.kind === 'pr' && merged[rowKey] === true) {
const fact = _stageTrackerTerminalFacts[rowKey];
return (fact && fact.until > nowMs) || Number(item.stage) >= STAGE_TRACKER_TERMINAL ? stageTrackerTerminalItem(item, rowKey) : null;
}
Expand All @@ -919,7 +922,7 @@
}
const linked = source.map(lp => {
const key = stageTrackerItemKey(stageTrackerLinkedPRItem(item, lp));
if (_stageTrackerMergeState[key] !== true) return lp;
if (merged[key] !== true) return lp;
const fact = _stageTrackerTerminalFacts[key];
return (fact && fact.until > nowMs) || Number(lp.stage) >= STAGE_TRACKER_TERMINAL ? stageTrackerTerminalItem(lp, key) : null;
}).filter(Boolean);
Expand Down
Loading
Loading