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(studio): guard missing scrollbar-gutter on Mac desktop startup (#14111)

Sourav Rajvi157b855f27bd
diff --git a/studio/frontend/src/components/assistant-ui/composer-column-inset.ts b/studio/frontend/src/components/assistant-ui/composer-column-inset.ts
index e07a8b5039e..a40b70310ed 100644
--- a/studio/frontend/src/components/assistant-ui/composer-column-inset.ts
+++ b/studio/frontend/src/components/assistant-ui/composer-column-inset.ts
@@ -68,7 +68,7 @@ export function readViewportBox(el: HTMLElement): ViewportBox {
borderRight: Number.parseFloat(style.borderRightWidth) || 0,
paddingLeft: Number.parseFloat(style.paddingLeft) || 0,
paddingRight: Number.parseFloat(style.paddingRight) || 0,
- bothEdges: style.scrollbarGutter.includes("both-edges"),
+ bothEdges: (style.scrollbarGutter ?? "").includes("both-edges"),
rtl: style.direction === "rtl",
};
}
diff --git a/studio/frontend/tests/composer-column-inset.test.ts b/studio/frontend/tests/composer-column-inset.test.ts
index aaa043270e4..b2a0df8804b 100644
--- a/studio/frontend/tests/composer-column-inset.test.ts
+++ b/studio/frontend/tests/composer-column-inset.test.ts
@@ -7,6 +7,7 @@ import test from "node:test";
import {
composerColumnInset,
composerInsetFromColumn,
+ readViewportBox,
} from "../src/components/assistant-ui/composer-column-inset.ts";
import { readSrc } from "./helpers/kit.ts";
@@ -28,6 +29,29 @@ const base = {
rtl: false,
};
+test("readViewportBox treats a missing scrollbar-gutter as one-sided", () => {
+ const el = {
+ offsetWidth: 700,
+ clientWidth: 678,
+ getBoundingClientRect: () => ({ left: 0, right: 700 }),
+ } as HTMLElement;
+ const view = globalThis as { getComputedStyle?: typeof getComputedStyle };
+ const saved = view.getComputedStyle;
+ view.getComputedStyle = () =>
+ ({
+ borderLeftWidth: "0",
+ borderRightWidth: "0",
+ paddingLeft: "20",
+ paddingRight: "20",
+ direction: "ltr",
+ }) as CSSStyleDeclaration;
+ try {
+ assert.equal(readViewportBox(el).bothEdges, false);
+ } finally {
+ view.getComputedStyle = saved;
+ }
+});
+
test("a both-edges gutter splits the scrollbar across the sides", () => {
assert.deepEqual(composerColumnInset(base, { left: 0, right: 700 }), {
left: 31,