From d84d4098438b2f399f554cbb4fd9128fc755e25b Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 28 Oct 2026 19:57:34 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20wrap=20the=20row=20menu's?= =?UTF-8?q?=20consequence=20hints=20under=20their=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The row menu's hinted items were a nowrap flex row sized for the short right-aligned 'rescan' hint, so the merge answers' sentence-length consequence hints ran ~1150px past the menu border. A menu with hints is now wider (capped to the viewport) and each hint stacks under its label and wraps; the rescan hint follows the same rule. Fixes #15175 Signed-off-by: Andrew Anderson --- changelog.d/fixed-row-menu-hint-wrap.md | 1 + .../stage_tracker_row_actions_test.go | 13 +++++++-- src/pkg/dashboard/static/index.html | 20 +++++++++++-- .../dashboard/webstatic/static_index_test.go | 29 +++++++++++++++++++ 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 changelog.d/fixed-row-menu-hint-wrap.md diff --git a/changelog.d/fixed-row-menu-hint-wrap.md b/changelog.d/fixed-row-menu-hint-wrap.md new file mode 100644 index 0000000000..6567b606e4 --- /dev/null +++ b/changelog.d/fixed-row-menu-hint-wrap.md @@ -0,0 +1 @@ +- Activity Monitor: the row menu's consequence hints ("merges #15118 into v5 now via hive's identity, attributed to you", "records your approval; the hive's merge sweep merges #15118 on its next pass…") no longer run past the menu border over the rows behind it — a menu with hints grows wider (capped to the viewport) and each hint wraps on its own line under its label, the rescan hint included (#15175). diff --git a/src/pkg/dashboard/stage_tracker_row_actions_test.go b/src/pkg/dashboard/stage_tracker_row_actions_test.go index 76a1215d6b..4ad770081a 100644 --- a/src/pkg/dashboard/stage_tracker_row_actions_test.go +++ b/src/pkg/dashboard/stage_tracker_row_actions_test.go @@ -68,6 +68,7 @@ func stageTrackerRowActionsPreamble(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerFlatActions"), jsFunc(t, html, "stageTrackerSelectionActions"), jsFunc(t, html, "stageTrackerMenuItemHtml"), + jsFunc(t, html, "stageTrackerMenuHasHints"), jsFunc(t, html, "stageTrackerMenuHtml"), jsFunc(t, html, "stageTrackerMenuPosition"), jsFunc(t, html, "stageTrackerSelBarHtml"), @@ -285,7 +286,7 @@ assert.strictEqual(by.open.enabled, true); // Menu markup. const menu = stageTrackerMenuHtml(as, 'o/r#1 · Parked'); -assert.ok(menu.startsWith('')); assert.strictEqual((menu.match(/role="menuitem"/g) || []).length, 11, 'six top-level items + five decide options'); assert.ok(menu.includes('data-ham-act="hold" tabindex="-1" aria-disabled="true" title="' + STAGE_TRACKER_WHY_WRITE + '"'), 'disabled items carry the reason'); @@ -620,7 +621,7 @@ const one = { ...issue, linked_prs: [issue.linked_prs[1]] }; assert.strictEqual(stageTrackerDecisionTarget(one).number, 15020, 'one parked PR: the issue row decides it, as before'); assert.ok(!ids(stageTrackerRowActions(one, ctx)).includes('decide:delegate-all')); const menu = stageTrackerMenuHtml(stageTrackerRowActions(issue, ctx), 'x'); -assert.ok(menu.includes('data-ham-act="decide:delegate-all"') && menu.includes('Let hive decide — all 2 PRsper PR')); +assert.ok(menu.includes('data-ham-act="decide:delegate-all"') && menu.includes('Let hive decide — all 2 PRsper PR')); // The selection model runs over sub-rows: keys in document order, painted // on the sub nodes; a sub-row click selects the PR, not its parent. @@ -1086,7 +1087,13 @@ const at = s => menu.indexOf(s); assert.ok(at('data-ham-act="decide:merge-now"') > 0 && at('data-ham-act="decide:merge-now"') < at('data-ham-act="decide:queue-merge"')); assert.ok(at('data-ham-act="decide:queue-merge"') < at('data-ham-act="decide"'), 'merge answers above Decide…'); assert.ok(at('data-ham-act="decide"') < at('data-ham-act="hold"') && at('data-ham-act="hold"') < at('data-ham-act="open"'), 'generic items last'); -assert.ok(menu.includes('merges #317 into main now via hive's identity, attributed to you') || menu.includes('merges #317 into main now via hive\'s identity, attributed to you'), 'consequence line rendered: ' + menu); +assert.ok(menu.includes('merges #317 into main now via hive's identity, attributed to you') || menu.includes('merges #317 into main now via hive\'s identity, attributed to you'), 'consequence line rendered: ' + menu); +// Hints stack under their label and the menu grows for them (#15175). +assert.ok(menu.startsWith('
]*data-ham-act="open"/.test(menu), 'items without a hint keep the inline layout'); +assert.ok(!stageTrackerMenuHtml([{ id: 'open', label: 'Open', enabled: true }], 'x').includes('ham-menu-hinted'), 'no hints: plain menu width'); +assert.ok(stageTrackerMenuHasHints([{ id: 'decide', label: 'Decide…', enabled: true, submenu: [{ id: 'x', label: 'x', hint: 'per PR' }] }]), 'a submenu hint counts'); // A writer without the merger role sees the merge answers, greyed with the // role reason — never silently missing. diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 177247fec6..ae944d658e 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1688,6 +1688,13 @@ .ham-menu-item[aria-disabled="true"]:hover { background: transparent; } .ham-menu-item.ham-menu-danger { color: var(--red); } .ham-menu-item .ham-menu-more { color: var(--text-faint); } + /* A menu whose items carry a consequence hint ("merges #N into v5 now + via hive's identity…") grows wider and stacks label over hint; the + hint wraps, so no hint length can run past the menu border + (see the fixed-row-menu-hint-wrap changelog fragment). */ + .ham-menu.ham-menu-hinted { max-width: min(45em, calc(100vw - 2 * var(--sp-3))); } + .ham-menu-item.ham-menu-item-hinted { flex-direction: column; align-items: flex-start; gap: var(--sp-1); white-space: normal; } + .ham-menu-item .ham-menu-hint { display: block; color: var(--text-faint); font-size: var(--fs-xs); white-space: normal; overflow-wrap: anywhere; } .ham-submenu { display: none; margin: 0 0 0 var(--sp-3); padding-left: var(--sp-2); border-left: var(--line-width) solid var(--line-subtle); } .ham-menu-item[aria-expanded="true"] + .ham-submenu { display: block; } /* tracker-cues: the Activity Monitor's shared cue vocabulary (owner, @@ -17327,12 +17334,19 @@

All labels

if (a.submenu) { return `${a.sep ? '' : ''}`; } - return `${a.sep ? '' : ''}`; + // A hint stacks under the label (ham-menu-item-hinted) and wraps, so + // the consequence line never overflows the menu (#15165). + return `${a.sep ? '' : ''}`; + } + // Pure: true when any action (or submenu action) carries a hint. + function stageTrackerMenuHasHints(actions) { + return (actions || []).some(a => !!a.hint || (a.submenu && stageTrackerMenuHasHints(a.submenu))); } // Pure: the menu markup (roles menu / menuitem, the Decide group as a - // nested menu toggled by its item). + // nested menu toggled by its item). A menu with hints is ham-menu-hinted + // (wider, hints stacked and wrapping). function stageTrackerMenuHtml(actions, head) { - return ``; + return ``; } // Pure: place the menu at the pointer, flipped/clamped to stay on screen. function stageTrackerMenuPosition(x, y, w, h, vw, vh) { diff --git a/src/pkg/dashboard/webstatic/static_index_test.go b/src/pkg/dashboard/webstatic/static_index_test.go index 221fd6bc55..79db965065 100644 --- a/src/pkg/dashboard/webstatic/static_index_test.go +++ b/src/pkg/dashboard/webstatic/static_index_test.go @@ -724,3 +724,32 @@ func TestStaticCostStaleRecordingNoticeWiring(t *testing.T) { } } } + +// TestStaticRowMenuHintWraps: the Activity Monitor row menu's consequence +// hints ("merges #15118 into v5 now via hive's identity, attributed to +// you") ran ~1150px past the menu border because the item was a nowrap +// flex row with the hint inline after the label. A menu with hints is +// wider (ham-menu-hinted), and each hint stacks under its label and wraps, +// so no hint length can overflow (hivecommons/hive#15175). +func TestStaticRowMenuHintWraps(t *testing.T) { + body, err := os.ReadFile("../static/index.html") + if err != nil { + t.Fatal(err) + } + html := string(body) + for _, want := range []string{ + `.ham-menu.ham-menu-hinted { max-width: min(45em, calc(100vw - 2 * var(--sp-3))); }`, + `.ham-menu-item.ham-menu-item-hinted { flex-direction: column; align-items: flex-start; gap: var(--sp-1); white-space: normal; }`, + `.ham-menu-item .ham-menu-hint { display: block; color: var(--text-faint); font-size: var(--fs-xs); white-space: normal; overflow-wrap: anywhere; }`, + `${a.hint ? ' ham-menu-item-hinted' : ''}`, + "${a.hint ? `${esc(a.hint)}` : ''}", + `
${esc(a.hint)}`) { + t.Error("a text hint must not reuse .ham-menu-more (the nowrap ▸ submenu affordance)") + } +}