Skip to content

Commit 2928cbf

Browse files
committed
fix(ui): strip board pill to move and menu on narrow widgets so the action corner stays widget-owned
1 parent bb185e3 commit 2928cbf

2 files changed

Lines changed: 49 additions & 2 deletions

File tree

‎ui/src/components/board/board-view.browser.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,37 @@ describe.skipIf(!hasBrowserLayout)("openclaw-board-view browser layout", () => {
176176
}
177177
});
178178

179+
it("strips the pill to move + menu on widgets too narrow for the reservation", async () => {
180+
const view = await mount();
181+
view.snapshot = {
182+
...structuredClone(source),
183+
widgets: [
184+
{
185+
...source.widgets[0]!,
186+
sizeW: 3,
187+
title: "An extremely long widget title that wants the whole bar",
188+
grantState: "granted",
189+
},
190+
],
191+
};
192+
await view.updateComplete;
193+
const cell = view.querySelector("openclaw-board-widget-cell");
194+
await cell?.updateComplete;
195+
const widget = view.querySelector<HTMLElement>('[data-test-id="board-widget"]');
196+
const bar = widget!.querySelector<HTMLElement>(".board-widget__bar");
197+
widget!.focus();
198+
expect(getComputedStyle(bar!).visibility).toBe("visible");
199+
// Below the 184px container threshold the display-only pieces disappear so
200+
// the pill is the irreducible move + menu pair and the rest of the card
201+
// stays widget-owned.
202+
expect(widget!.getBoundingClientRect().width).toBeLessThan(184);
203+
const title = bar!.querySelector<HTMLElement>(".board-widget__title");
204+
const kind = bar!.querySelector<HTMLElement>(".board-widget__kind");
205+
expect(getComputedStyle(title!).display).toBe("none");
206+
expect(getComputedStyle(kind!).display).toBe("none");
207+
expect(bar!.getBoundingClientRect().width).toBeLessThanOrEqual(76);
208+
});
209+
179210
it("keeps widget chrome visible while its menu is open", async () => {
180211
const view = await mount();
181212
const sink = focusSink();

‎ui/src/styles/board.css‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,11 @@ openclaw-workboard-mini-widget {
743743

744744
@media (hover: hover) and (pointer: fine) {
745745
/* Focus keeps keyboard actions reachable; menu-open and dragging keep chrome
746-
pinned when interaction leaves the card bounds. */
746+
pinned when interaction leaves the card bounds. Inline-size containment
747+
lets the pill drop to its minimal form on narrow cards; grid tracks set
748+
the card's width, so containment changes no layout. */
747749
.board-widget {
750+
container-type: inline-size;
748751
grid-template-rows: minmax(0, 1fr);
749752
}
750753

@@ -764,7 +767,8 @@ openclaw-workboard-mini-widget {
764767
/* Reserve a widget-owned top-right action region: the interactive pill may
765768
never stretch across the card, or it re-intercepts the exact corner this
766769
chrome exists to keep clickable. The 88px floor keeps the drag handle and
767-
menu usable on very narrow widgets, trading reservation width there. */
770+
menu usable on very narrow widgets; below 184px the container query strips
771+
the pill to that irreducible pair so the reservation stays maximal. */
768772
max-width: max(88px, calc(100% - 96px));
769773
opacity: 0;
770774
padding: 0 5px;
@@ -794,6 +798,18 @@ openclaw-workboard-mini-widget {
794798
overflow: hidden;
795799
}
796800

801+
/* Below 184px the 96px reservation and the 88px pill cannot coexist, so the
802+
pill sheds its display-only pieces and keeps just move + menu — the two
803+
controls without which a widget cannot be managed. The card's aria-label
804+
and the drag handle tooltip still carry the title. */
805+
@container (max-width: 184px) {
806+
.board-widget__bar > .board-widget__title,
807+
.board-widget__bar > .board-widget__kind,
808+
.board-widget__bar > .board-widget__capabilities {
809+
display: none;
810+
}
811+
}
812+
797813
.board-widget__resize-handle {
798814
opacity: 0;
799815
transition:

0 commit comments

Comments
 (0)