diff --git a/changed-gate-fold-tap-target.md b/changed-gate-fold-tap-target.md new file mode 100644 index 0000000000..e47dc05587 --- /dev/null +++ b/changed-gate-fold-tap-target.md @@ -0,0 +1 @@ +Activity Monitor: the human-gate pill folds its verbs at render time (three on the strip tier, one plus `…` at ≤1100px), keeps the folded verbs in a template until `…` opens, and gives the `…` button its 44px tap target — the row holds no hidden buttons for the header-geometry probe to reject. diff --git a/changelog.d/fixed-17515.md b/changelog.d/fixed-17515.md new file mode 100644 index 0000000000..d0a22d0bcd --- /dev/null +++ b/changelog.d/fixed-17515.md @@ -0,0 +1 @@ +- dashboard: fold the human-gate verbs at render time; keeps its 44px tap target (#17515) diff --git a/src/pkg/dashboard/stage_tracker_human_gate_test.go b/src/pkg/dashboard/stage_tracker_human_gate_test.go index 0eb5a4c8f7..5fe49ba69b 100644 --- a/src/pkg/dashboard/stage_tracker_human_gate_test.go +++ b/src/pkg/dashboard/stage_tracker_human_gate_test.go @@ -15,6 +15,7 @@ func stageTrackerHumanGateJS(t *testing.T, html string) string { jsConstLine(t, html, "STAGE_TRACKER_GATE_WORD"), jsConstLine(t, html, "STAGE_TRACKER_GATE_SETTLING"), jsConstLine(t, html, "STAGE_TRACKER_GATE_VISIBLE"), + jsConstLine(t, html, "STAGE_TRACKER_GATE_FOLD_QUERY"), jsConstBlock(t, html, "STAGE_TRACKER_GATE_VERBS"), jsConstLine(t, html, "STAGE_TRACKER_GATE_ORDER"), jsConstLine(t, html, "STAGE_TRACKER_GATE_PR_ONLY"), @@ -28,6 +29,7 @@ func stageTrackerHumanGateJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerHumanGateTip"), jsFunc(t, html, "stageTrackerHumanGateVerbState"), jsFunc(t, html, "stageTrackerHumanGateVerbHtml"), + jsFunc(t, html, "stageTrackerHumanGateVisible"), jsFunc(t, html, "stageTrackerHumanGateHtml"), }, "\n") } @@ -130,8 +132,8 @@ assert.strictEqual(reasons(row), 'review sentinel', 'review verdict + sentinel a assert.strictEqual(gateWord(row), 'Needs human · review, sentinel'); assert.ok(gateTip(row).includes(question.replace(/\?/g, '?')) && gateTip(row).includes('touches .github/workflows'), 'the status hover is the question and the rule: ' + gateTip(row)); assert.deepStrictEqual(verbs(row), ['Approve', 'Request changes…', 'Let hive decide', 'Confirm safe'], 'union of the review and sentinel verb sets, de-duplicated'); -assert.ok(row.includes('data-ham-gate-overflow="1"') && /
') && row.includes('Needs human decision'), 'the expander line still names the decision');
@@ -170,8 +172,8 @@ assert.strictEqual(gates(row), 1, row);
assert.strictEqual(reasons(row), 'decision');
assert.deepStrictEqual(verbs(row), ['Decide…', 'Approve as-is', 'Let hive decide']);
assert.ok(gateTip(row).includes('Two fixes are possible'), gateTip(row));
-assert.ok(row.includes('data-ham-gate-overflow="0"'), 'three verbs need no overflow on the strip tier (the … is the phone tier\'s fold)');
-assert.strictEqual((row.match(/ham-gate-act-rest/g) || []).length, 2, 'the verbs after the first fold on the phone tier');
+assert.ok(!row.includes('data-ham-gate-more'), 'three verbs need no … on the strip tier');
+assert.strictEqual((row.match(/class="ham-lead-act ham-gate-act[^"]*"/g) || []).length, 3, 'all three verbs are inline');
assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured ham-human-gated', 'todo cap'], strip(row));
assert.ok(row.includes('Merge queue'), 'the chevron reads its column: ' + strip(row));
diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css
index 7acbbe0327..079f2b3049 100644
--- a/src/pkg/dashboard/static-src/css/tracker.css
+++ b/src/pkg/dashboard/static-src/css/tracker.css
@@ -987,18 +987,15 @@
.ham-human-gate > .ham-gate-status > .ham-mod-word { overflow: hidden; text-overflow: ellipsis; }
.ham-human-gate > button.ham-gate-status { cursor: pointer; }
.ham-human-gate > button.ham-gate-status:hover, .ham-human-gate > button.ham-gate-status:focus-visible { text-decoration: underline; outline: none; }
- .ham-human-gate > .ham-gate-act { --ham-gate-seg-radius: 0; border-radius: var(--ham-gate-seg-radius); border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; }
- .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate > .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); }
- .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; }
+ .ham-human-gate > .ham-gate-act, .ham-human-gate .ham-gate-more { --ham-gate-seg-radius: 0; border-radius: var(--ham-gate-seg-radius); border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; }
+ .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); }
+ .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible, .ham-human-gate .ham-gate-more:hover, .ham-human-gate .ham-gate-more:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; }
.ham-human-gate > .ham-gate-act.ham-act-primary:hover, .ham-human-gate > .ham-gate-act.ham-act-primary:focus-visible { filter: brightness(1.12); }
- .ham-human-gate > .ham-gate-more { padding-inline: var(--sp-2); }
- .ham-human-gate > .ham-gate-more::after { content: none; }
- .ham-human-gate > .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); }
+ .ham-human-gate .ham-gate-more { padding-inline: var(--sp-2); }
+ .ham-human-gate .ham-gate-more::after { content: none; }
+ .ham-human-gate .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); }
.ham-human-gate.ham-gate-settling { opacity: 0.75; border-style: dashed; }
.ham-human-gate.ham-gate-settling > .ham-gate-status { color: var(--cue-work); }
- /* Strip tier: the … button only when a verb overflows; menu copies of
- the inline verbs stay hidden. The phone tier flips both. */
- .ham-gate-more-wrap[data-ham-gate-overflow="0"], .ham-gate-menu > [data-ham-gate-inline] { display: none; }
.ham-gate-menu[hidden] { display: none; }
/* The passive "decision pending on #N" chip is a link to the primary row. */
.ham-decision-pending[data-ham-scroll-to] { text-decoration: underline dotted; text-underline-offset: var(--sp-1); }
@@ -1031,11 +1028,6 @@
.ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-ico { margin-right: 0; }
.ham-head-cols .ham-human-gate > .ham-gate-status > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ham-head-cols .ham-human-gate > .ham-gate-status { position: relative; padding-right: var(--sp-2); }
- /* Stacked head: the first verb inline, the rest behind …, so the pill
- leaves the title its line and no verb is squeezed into a fragment. */
- .ham-head-cols .ham-human-gate > .ham-gate-act-rest { display: none; }
- .ham-head-cols .ham-human-gate .ham-gate-more-wrap[data-ham-gate-overflow="0"] { display: inline; }
- .ham-head-cols .ham-human-gate .ham-gate-menu > [data-ham-gate-inline] { display: flex; }
.ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); }
.ham-row .ham-seg.cap { flex-basis: 2em; }
.ham-since { width: 3em; }
@@ -1271,10 +1263,9 @@
/* Gate segments keep the one-line pill; each segment pads its hit area
out to the tap target so the phone harness sees ≥44×44. */
#activity-monitor-section .ham-human-gate { display: inline-flex; line-height: inherit; vertical-align: baseline; }
- #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; display: inline-flex; min-width: var(--tap-target); min-height: 0; height: auto; padding-block: 0; line-height: inherit; }
- #activity-monitor-section .ham-human-gate > .ham-gate-act-rest { display: none; }
+ #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; display: inline-flex; min-width: var(--tap-target); min-height: 0; height: auto; padding-block: 0; line-height: inherit; }
- #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate > .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; }
+ #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; }
#activity-monitor-section .ham-badge-mod.ham-decision-trigger::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) calc((100% - var(--tap-target)) / 2); }
/* A card keeps its two-line head and its density (#17161): the 🗒
shows on a phone only once the item has notes; the row's ⋯ menu
diff --git a/src/pkg/dashboard/static-src/js/tracker-human-gate.js b/src/pkg/dashboard/static-src/js/tracker-human-gate.js
index 57d2d72534..eb0d6f8471 100644
--- a/src/pkg/dashboard/static-src/js/tracker-human-gate.js
+++ b/src/pkg/dashboard/static-src/js/tracker-human-gate.js
@@ -25,6 +25,7 @@
const STAGE_TRACKER_GATE_WORD = 'Needs human';
const STAGE_TRACKER_GATE_SETTLING = 'settling…';
const STAGE_TRACKER_GATE_VISIBLE = 3;
+ const STAGE_TRACKER_GATE_FOLD_QUERY = '(max-width: 1100px)';
// Reason → verbs, in the order they stand on the pill. The same reason
// always offers the same verbs (the maintainer's "consistent way").
const STAGE_TRACKER_GATE_VERBS = {
@@ -134,16 +135,23 @@
if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' };
return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' };
}
- // more: a menu item. inline: this menu item doubles a verb that is also
- // drawn inline on the strip tier (the phone tier hides the inline copy
- // and shows this one). rest: an inline verb after the first (the phone
- // tier folds it into the … menu).
- function stageTrackerHumanGateVerbHtml(item, v, state, more, inline, rest) {
+ function stageTrackerHumanGateVerbHtml(item, v, state, more) {
const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : '';
const tip = state.enabled ? v.posts : state.why;
const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`;
- if (more) return ``;
- return ``;
+ if (more) return ``;
+ return ``;
+ }
+ // How many verbs ride inline: three on the strip tier; one on the
+ // stacked head (≤ 1100px, which includes the phone card) so the pill
+ // stays one line and leaves the title its room — the rest fold behind
+ // the … menu. Rows re-render when the viewport crosses the breakpoint.
+ function stageTrackerHumanGateVisible() {
+ return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(STAGE_TRACKER_GATE_FOLD_QUERY).matches ? 1 : STAGE_TRACKER_GATE_VISIBLE;
+ }
+ if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
+ const mq = window.matchMedia(STAGE_TRACKER_GATE_FOLD_QUERY);
+ if (mq && typeof mq.addEventListener === 'function') mq.addEventListener('change', () => { if (typeof renderStageTracker === 'function') renderStageTracker(); });
}
// Pure: the pill. '' when the row has no gate. The status segment is
// the decision popover's trigger when the row carries a decision, else
@@ -183,15 +191,14 @@
const status = decision && typeof stageTrackerDecisionTriggerHtml === 'function'
? stageTrackerDecisionTriggerHtml(decision, inner, tip, 'ham-gate-status ham-mod-ask')
: `${inner}`;
- const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE);
- const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE);
- const acts = shownVerbs.map((v, i) => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false, false, i > 0)).join('');
- // The … menu holds every verb after the first: on the strip tier CSS
- // shows only the ones past STAGE_TRACKER_GATE_VISIBLE (and hides the
- // button when there are none); the phone tier shows the first verb
- // inline and the rest here, so the pill stays one line (#17161).
- const menuVerbs = verbs.slice(1);
- const more = menuVerbs.length ? `All labels
const STAGE_TRACKER_GATE_WORD = 'Needs human';
const STAGE_TRACKER_GATE_SETTLING = 'settling…';
const STAGE_TRACKER_GATE_VISIBLE = 3;
+ const STAGE_TRACKER_GATE_FOLD_QUERY = '(max-width: 1100px)';
// Reason → verbs, in the order they stand on the pill. The same reason
// always offers the same verbs (the maintainer's "consistent way").
const STAGE_TRACKER_GATE_VERBS = {
@@ -26418,16 +26410,23 @@ All labels
if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' };
return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' };
}
- // more: a menu item. inline: this menu item doubles a verb that is also
- // drawn inline on the strip tier (the phone tier hides the inline copy
- // and shows this one). rest: an inline verb after the first (the phone
- // tier folds it into the … menu).
- function stageTrackerHumanGateVerbHtml(item, v, state, more, inline, rest) {
+ function stageTrackerHumanGateVerbHtml(item, v, state, more) {
const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : '';
const tip = state.enabled ? v.posts : state.why;
const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`;
- if (more) return ``;
- return ``;
+ if (more) return ``;
+ return ``;
+ }
+ // How many verbs ride inline: three on the strip tier; one on the
+ // stacked head (≤ 1100px, which includes the phone card) so the pill
+ // stays one line and leaves the title its room — the rest fold behind
+ // the … menu. Rows re-render when the viewport crosses the breakpoint.
+ function stageTrackerHumanGateVisible() {
+ return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(STAGE_TRACKER_GATE_FOLD_QUERY).matches ? 1 : STAGE_TRACKER_GATE_VISIBLE;
+ }
+ if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
+ const mq = window.matchMedia(STAGE_TRACKER_GATE_FOLD_QUERY);
+ if (mq && typeof mq.addEventListener === 'function') mq.addEventListener('change', () => { if (typeof renderStageTracker === 'function') renderStageTracker(); });
}
// Pure: the pill. '' when the row has no gate. The status segment is
// the decision popover's trigger when the row carries a decision, else
@@ -26467,15 +26466,14 @@ All labels
const status = decision && typeof stageTrackerDecisionTriggerHtml === 'function'
? stageTrackerDecisionTriggerHtml(decision, inner, tip, 'ham-gate-status ham-mod-ask')
: `${inner}`;
- const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE);
- const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE);
- const acts = shownVerbs.map((v, i) => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false, false, i > 0)).join('');
- // The … menu holds every verb after the first: on the strip tier CSS
- // shows only the ones past STAGE_TRACKER_GATE_VISIBLE (and hides the
- // button when there are none); the phone tier shows the first verb
- // inline and the rest here, so the pill stays one line (#17161).
- const menuVerbs = verbs.slice(1);
- const more = menuVerbs.length ? `All labels
const b = e.target.closest ? e.target.closest('[data-ham-gate-more]') : null;
if (!b) { if (!(e.target.closest && e.target.closest('.ham-gate-menu'))) closeAll(); return; }
e.preventDefault(); e.stopPropagation();
- const menu = b.nextElementSibling;
+ let menu = b.nextElementSibling;
+ if (menu && menu.tagName === 'TEMPLATE') { const stamped = menu.content.firstElementChild.cloneNode(true); menu.replaceWith(stamped); menu = stamped; }
const open = menu && menu.hidden;
closeAll();
if (menu && open) { menu.hidden = false; b.setAttribute('aria-expanded', 'true'); const first = menu.querySelector('[role="menuitem"]'); if (first) first.focus(); }