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.

Studio: fix browser toolbar alignment and narrow layouts (#14018)

Lee Jacksone469bfe3bb47
diff --git a/studio/frontend/src/features/browser/browser-panel.tsx b/studio/frontend/src/features/browser/browser-panel.tsx
index 024423514d2..fbc7805eab0 100644
--- a/studio/frontend/src/features/browser/browser-panel.tsx
+++ b/studio/frontend/src/features/browser/browser-panel.tsx
@@ -637,7 +637,7 @@ function TabStrip({
// Above the desktop titlebar's drag strip (z-40), which would swallow tab clicks.
<div
data-tauri-drag-region={true}
- className="browser-chrome relative z-40 flex h-[var(--studio-chat-header-height,48px)] min-w-0 shrink-0 items-center gap-1 pl-1.5 pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-window-control-inset,0px))]"
+ className="browser-chrome relative z-40 flex h-[var(--studio-chat-header-height,48px)] min-w-0 shrink-0 items-center gap-1 pl-1.5 pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]"
>
<div
ref={listRef}
@@ -2462,7 +2462,7 @@ export const BrowserPanel = memo(function BrowserPanel({ active = true }: { acti
}
}}
className={cn(
- "relative flex h-full min-h-0 flex-col overflow-hidden bg-muted pt-[var(--studio-content-top-inset,0px)]",
+ "browser-panel @container/browser relative flex h-full min-h-0 flex-col overflow-hidden bg-muted pt-[var(--studio-content-top-inset,0px)]",
documentShown
? "[--browser-surface:color-mix(in_oklab,var(--muted)_55%,var(--card))]"
: "[--browser-surface:var(--card)]",
@@ -2473,6 +2473,7 @@ export const BrowserPanel = memo(function BrowserPanel({ active = true }: { acti
<div
className={cn(
"browser-chrome @container flex shrink-0 items-center gap-2 px-2.5",
+ (!activeEntry || activeEntry.kind !== "file") && "browser-web-toolbar flex-wrap",
floatingFileControls
? "browser-file-toolbar pointer-events-none absolute inset-x-0 top-0 z-20 py-2 *:pointer-events-auto"
: // 1px less at the bottom for the page's top border.
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index ed5e5db4a07..8272129bb66 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -5334,6 +5334,32 @@ html.force-reduced-motion .sidebar-section-drop-line {
box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
}
+/* Scales the container query's em with the UI size; children reset to the inherited 1rem. */
+.browser-panel {
+ font-size: calc(1rem * var(--ui-space-scale, 1));
+}
+
+.browser-panel > * {
+ font-size: 1rem;
+}
+
+/* Keep a usable address field when the fixed navigation and action buttons no longer fit. */
+@container browser (width < 22em) {
+ .browser-web-toolbar {
+ column-gap: 0;
+ padding-inline: calc(0.375rem * var(--ui-space-scale, 1));
+ }
+
+ .browser-web-toolbar > form {
+ order: -1;
+ flex-basis: 100%;
+ }
+
+ .browser-web-toolbar > form ~ div {
+ margin-inline-start: auto;
+ }
+}
+
/* The browser's tabs scroll sideways once they're at their narrowest, with no bar. */
.browser-tablist {
scrollbar-width: none;
diff --git a/tests/studio/test_ui_font_scale_contract.py b/tests/studio/test_ui_font_scale_contract.py
index d165a89f44e..c4f0df50389 100644
--- a/tests/studio/test_ui_font_scale_contract.py
+++ b/tests/studio/test_ui_font_scale_contract.py
@@ -24,6 +24,18 @@ FONTSIZE_STYLE_ALLOWLIST = {
"lib/copy-to-clipboard.ts",
}
+# Sizes a container query's em breakpoint, not text (--ui-space-scale derives
+# from --ui-font-scale); children reset to the 1rem they would inherit.
+CSS_FONTSIZE_LAYOUT_RULES = {
+ (".browser-panel", "font-size: calc(1rem * var(--ui-space-scale, 1));"),
+ (".browser-panel > *", "font-size: 1rem;"),
+}
+
+
+def _css_selector_before(text, pos):
+ head = re.sub(r"/\*.*?\*/", "", text[:pos].rsplit("{", 1)[0], flags = re.S)
+ return re.split(r"[{};]", head)[-1].strip()
+
def _frontend_sources():
for path in sorted(SRC.rglob("*")):
@@ -162,6 +174,9 @@ def test_css_font_sizes_reference_the_scale():
continue
if "1px" in decl:
continue # library layout tricks (KaTeX-style), not text
+ selector = _css_selector_before(text, m.start())
+ if (selector, decl.strip()) in CSS_FONTSIZE_LAYOUT_RULES:
+ continue
offenders.append(f"{_rel(path)}: {decl.strip()[:80]}")
assert offenders == [], (
"CSS typography must multiply by var(--ui-font-scale, 1) or be "