Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix the update card clipping its own buttons at the 20px interface size (#11510)

Daniel Hande71b32593b0
diff --git a/studio/frontend/src/components/web/update-banner.tsx b/studio/frontend/src/components/web/update-banner.tsx
index 4b36753ad8e..90ff73a081a 100644
--- a/studio/frontend/src/components/web/update-banner.tsx
+++ b/studio/frontend/src/components/web/update-banner.tsx
@@ -88,13 +88,25 @@ export function WebUpdateBanner({
"pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] shrink-0 flex-col",
// Only rendered notes may shrink in the capped rail. Without
// them, shrink-0 keeps the compact card at its natural height.
- "has-[[data-slot=update-release-notes]]:min-h-[calc(109px+80px*var(--ui-font-scale,1))] has-[[data-slot=update-release-notes]]:shrink max-[383px]:has-[[data-slot=update-release-notes]]:min-h-[calc(139px+96px*var(--ui-font-scale,1))]",
+ // How far it may shrink is the surface's own content floor
+ // below, not a written-out number: a constant calibrated at
+ // one type size stops covering the card the moment anything
+ // inside it scales, and the buttons are what gets cut.
+ "has-[[data-slot=update-release-notes]]:shrink",
),
)}
data-testid="web-update-banner"
>
- {/* Paint the full floor even when the notes content is short. */}
- <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 grow flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
+ {/* Paint the full floor even when the notes content is short.
+ No min-h-0 and no overflow-hidden here on purpose: both of them
+ set this box's automatic minimum size to zero, which is what made
+ the card need a hand-written floor at all. Left alone it floors
+ itself at header + notes + actions, and the notes panel carries
+ its own min-h-0 and clipping, so it stays the one part that
+ yields. That is the floor the constant was approximating, except
+ it is measured rather than guessed and it holds at every type
+ size. */}
+ <div className="relative flex max-h-[calc(100dvh_-_2rem)] grow flex-col rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
<button
type="button"
onClick={dismiss}
diff --git a/studio/frontend/tests/update-banner-flex-priority.test.ts b/studio/frontend/tests/update-banner-flex-priority.test.ts
index 7f2b8db4d92..afd80a50229 100644
--- a/studio/frontend/tests/update-banner-flex-priority.test.ts
+++ b/studio/frontend/tests/update-banner-flex-priority.test.ts
@@ -64,21 +64,38 @@ for (const [name, source] of CARDS) {
test(`the ${name} card stops shrinking at its buttons`, () => {
const stacked = classes(source, "pointer-events-auto flex ");
- // The floor is the header and the action row. It has to follow
- // --ui-font-scale, not be measured once at the default type size:
- // Settings > Appearance goes to 20px, where the action row wraps at every
- // card width and a 128px floor cuts the buttons in half. A fixed part plus
- // a scaled one, since only some of the card moves with the setting, and
- // scaling the whole box asked 256px where 209 was needed.
+ // The floor is the header and the action row, and the two cards reach it
+ // two different ways. The desktop card still writes it out against
+ // --ui-font-scale. The browser card stopped naming a height at all: a
+ // constant is calibrated at one type size, and #11458 made the spacing
+ // inside the card follow the setting too, so at 20px the written floor
+ // came to 209px while the content needed about 301 and the action row was
+ // cut. Its surface declares neither min-h-0 nor overflow-hidden, so its
+ // automatic minimum size is its own content and cannot go stale.
assert.ok(
!/\bmin-h-0\b/.test(stacked),
"min-h-0 lets the rail squeeze the card to nothing",
);
- assert.match(
- source,
- /min-h-\[calc\(\d+px\+\d+px\*var\(--ui-font-scale,1\)\)\]/,
- "the floor does not track the type size in the shape index.css uses",
- );
+ if (name === "web") {
+ const surface = classes(source, "relative flex max-h-[");
+ for (const zeroesTheFloor of ["min-h-0", "overflow-hidden"]) {
+ assert.ok(
+ !surface.split(/\s+/).includes(zeroesTheFloor),
+ `${zeroesTheFloor} puts the card's floor back to nothing`,
+ );
+ }
+ assert.doesNotMatch(
+ source,
+ /min-h-\[/,
+ "the card names a height again, which goes stale at the next type size",
+ );
+ } else {
+ assert.match(
+ source,
+ /min-h-\[calc\(\d+px\+\d+px\*var\(--ui-font-scale,1\)\)\]/,
+ "the floor does not track the type size in the shape index.css uses",
+ );
+ }
assert.ok(
!/12rem\*var\(--ui-font-scale/.test(source),
"the whole box is being scaled again, which over-reserves the floor",
@@ -100,11 +117,13 @@ test("a card with no notes panel does not shrink at all", () => {
/["\s]min-h-\[calc\(/,
`the ${name} card floors unconditionally again, around a card that may paint none of it`,
);
- assert.match(
- source,
- /has-\[\[data-slot=update-release-notes\]\]:min-h-\[calc\(/,
- `the ${name} card's floor is not gated on its notes panel`,
- );
+ if (name !== "web") {
+ assert.match(
+ source,
+ /has-\[\[data-slot=update-release-notes\]\]:min-h-\[calc\(/,
+ `the ${name} card's floor is not gated on its notes panel`,
+ );
+ }
assert.match(
source,
/has-\[\[data-slot=update-release-notes\]\]:shrink\b/,
diff --git a/tests/studio/playwright_update_banner_layout.py b/tests/studio/playwright_update_banner_layout.py
index b0ca5091441..95b125722e6 100644
--- a/tests/studio/playwright_update_banner_layout.py
+++ b/tests/studio/playwright_update_banner_layout.py
@@ -523,6 +523,11 @@ MEASURE = """
toggle: clip(toggle, surface),
snooze: clip(snooze, surface),
copy: clip(copy, surface),
+ // The same three unclipped, so a control the card has cut DOWN is as visible
+ // here as one it cut away. Half a button is not the button the card promises.
+ toggleWhole: rect(toggle),
+ snoozeWhole: rect(snooze),
+ copyWhole: rect(copy),
footer: rect(footer),
llamaText: llama ? (llama.innerText || '') : '',
// pointer-events-none costs the rail its scrollbar, so it may only be
@@ -748,6 +753,21 @@ def measure(page, label: str) -> dict:
box is not None and box["height"] > 1.0 and box["width"] > 1.0,
f"{name}={box}",
)
+ # Clipped to nothing is the loud version. A control the card has cut DOWN is the same
+ # defect one viewport earlier: at the 20px setting the card's floor was a constant that
+ # stopped covering its own content, so the action row overflowed and the last button was
+ # sliced before it disappeared. Asking only that something is left lets the slicing
+ # through, and the slicing is what says the floor is wrong.
+ for name in ("toggle", "snooze", "copy"):
+ box, whole = facts[name], facts[f"{name}Whole"]
+ check(
+ f"{label}: the card shows all of its own {name}",
+ box is not None
+ and whole is not None
+ and box["height"] >= whole["height"] - 1.0
+ and box["width"] >= whole["width"] - 1.0,
+ f"{name}={box} whole={whole}",
+ )
return facts
diff --git a/tests/studio/test_update_release_notes.py b/tests/studio/test_update_release_notes.py
index b343c78533d..0e1a603d554 100644
--- a/tests/studio/test_update_release_notes.py
+++ b/tests/studio/test_update_release_notes.py
@@ -1322,16 +1322,29 @@ def test_notes_repair_the_shared_previews_width_reset():
def test_only_the_notes_region_scrolls(banner):
"""The dismiss control sits inside the card, so the card must not scroll."""
src = banner.read_text(encoding = "utf-8")
- # The painted surface: capped, clipping, and able to give up height itself
- # so that the region inside it is the one that scrolls.
- _assert_classes(
- _card_surface(src),
- "flex",
- "max-h-[calc(100dvh_-_2rem)]",
- "min-h-0",
- "flex-col",
- "overflow-hidden",
- )
+ surface = _card_surface(src)
+ # The painted surface: capped, and a column, so the region inside it is the
+ # one that scrolls.
+ _assert_classes(surface, "flex", "max-h-[calc(100dvh_-_2rem)]", "flex-col")
+ # Neither card scrolls. Asserted as the absence of a scrolling overflow
+ # rather than as the presence of `overflow-hidden`, because those are two
+ # different claims: the browser card now clips nothing at all, and reading
+ # the clip as the no-scroll guarantee is what tied this contract to a
+ # mechanism instead of to what it is for.
+ assert not re.search(
+ r"(?<![\w-])overflow-(?:y-)?(?:auto|scroll)(?![\w-])", surface
+ ), "the card scrolls, so its dismiss control can leave the viewport"
+ if banner == WEB_BANNER:
+ # This surface floors itself at header + notes + actions, which is only
+ # true while it declares neither of the two things that set a flex
+ # item's automatic minimum size to zero. Either one back and the rail
+ # squeezes the card until the action row is cut.
+ for zeroes_the_floor in ("min-h-0", "overflow-hidden"):
+ assert (
+ zeroes_the_floor not in surface.split()
+ ), f"{zeroes_the_floor} puts the browser card's floor back to nothing"
+ else:
+ _assert_classes(surface, "min-h-0", "overflow-hidden")
layout = NOTES_LAYOUT.read_text(encoding = "utf-8")
_assert_classes(
_class_const(layout, "UPDATE_NOTES_ROOT_CLASS"),
@@ -1547,19 +1560,12 @@ def test_code_span_closers_ignore_backslashes():
assert '!== "`" || escaped(' in calls[0]
-# The card's incompressible height, a fixed part plus a part that follows
-# Settings > Appearance rather than one number measured at the default 15px: at
-# the 20px maximum the action row wraps at every card width. The two cards have
-# their own constants because the desktop one carries an extra status line;
-# scaling one whole box for both asked 256px where 209 was needed, and a floor
-# nothing can meet makes the stack cover the composer for no gain.
-_SCALED_FLOOR_WEB = "min-h-[calc(109px+80px*var(--ui-font-scale,1))]"
-# Below 384px the action pair wraps onto its own row and the card needs a
-# whole extra one: 259px at the 20px setting where the wide card needs 209.
-# Named as the utility alone and asserted under `max-[383px]` through
-# `_applies`, because the floor also carries a `has-[...]` gate since #10229
-# and a run of variants has no fixed order.
-_NARROW_FLOOR_WEB = "min-h-[calc(139px+96px*var(--ui-font-scale,1))]"
+# The desktop card's incompressible height, a fixed part plus a part that
+# follows Settings > Appearance rather than one number measured at the default
+# 15px: at the 20px maximum the action row wraps at every card width. The
+# browser card used to carry the same pair of constants and now floors itself
+# off its own content instead (see _assert_floors_itself); this one still names
+# the height, and the same staleness is waiting for it.
_SCALED_FLOOR_TAURI = "min-h-[calc(117px+93px*var(--ui-font-scale,1))]"
_NARROW_FLOOR_TAURI = "min-h-[calc(24px+224px*var(--ui-font-scale,1))]"
_NARROW = "max-[383px]"
@@ -1676,6 +1682,37 @@ def _assert_floored(source: str, scaled: str, narrow: str, card: str) -> None:
), f"min-h-0 lets the rail squeeze the {card} card past its floor"
+def _assert_floors_itself(source: str, card: str) -> None:
+ """The card keeps room for its header and buttons without naming a height.
+
+ The written-out floor it replaces was a constant against one type size, and
+ #11458 made the spacing inside the card follow the interface font size too,
+ so at the 20px setting the constant came to 209px while the content needed
+ about 301px and the action row was cut. A measured floor cannot go stale
+ that way, but it only exists while the surface declares neither `min-h-0`
+ nor `overflow-hidden`: each of those sets a flex item's automatic minimum
+ size to zero, which is what made a hand-written floor necessary at all.
+ """
+ root = _card_slot(source)
+ surface = _card_surface(source)
+ for zeroes_the_floor in ("min-h-0", "overflow-hidden"):
+ assert (
+ zeroes_the_floor not in surface.split()
+ ), f"{zeroes_the_floor} leaves the {card} card with no floor at all"
+ assert not re.search(
+ r"(?<![\w-])min-h-\[", surface + root
+ ), f"the {card} card names a height again, which goes stale at the next type size"
+ # Unchanged from the written-floor days: the rail may only take the height
+ # the notes are there to give up.
+ assert _only_under(root, "shrink-0"), f"the rail can squeeze the {card} card with no notes open"
+ assert _only_under(
+ root, "shrink", _NOTES_GATE
+ ), f"the {card} card cannot give up its notes' height, so the rail clips its buttons"
+ assert not _applies(
+ root, "min-h-0"
+ ), f"min-h-0 lets the rail squeeze the {card} card past its floor"
+
+
RAIL_TESTID = "overlay-rail"
@@ -1868,9 +1905,9 @@ def test_the_overlay_stack_fits_the_viewport():
# The download list scrolls internally, so it can give up height.
assert "flex min-h-0" in panel
# The update card cannot: its header and buttons are fixed and only its
- # notes yield, so it floors instead.
- web = WEB_BANNER.read_text(encoding = "utf-8")
- _assert_floored(web, _SCALED_FLOOR_WEB, _NARROW_FLOOR_WEB, "browser")
+ # notes yield, so it floors instead. The browser card floors itself off its
+ # own content; the desktop card still states the floor as a constant.
+ _assert_floors_itself(WEB_BANNER.read_text(encoding = "utf-8"), "browser")
# Those floors can add up to more than the cap at a large type size, so the
# rail scrolls. Without this the overflow lands below the bottom of the
# screen with no way to reach it.