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: centre the chat column by reserving the scrollbar gutter on both edges (#10966)

Michael Han1811677f024a
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index 2211dff415c..2084d833458 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -2133,7 +2133,9 @@ const ThreadComposerDock: FC<{
<div
ref={dockRef}
className={cn(
- "aui-thread-composer-dock pointer-events-none absolute bottom-0 left-0 right-0 md:right-[10px]",
+ // Inset both sides, not just the right: the offset keeps the bottom
+ // fade off the scrollbar, and a one-sided one also moves the centre.
+ "aui-thread-composer-dock pointer-events-none absolute bottom-0 left-0 right-0 md:left-[10px] md:right-[10px]",
overlay ? "z-40" : "z-20",
)}
>
diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx
index d1de996f544..9d791cc5efe 100644
--- a/studio/frontend/src/features/chat/chat-page.tsx
+++ b/studio/frontend/src/features/chat/chat-page.tsx
@@ -805,7 +805,9 @@ function CompareShell({
>
{children}
</div>
- <div className="shrink-0 bg-background pl-5 pr-5 md:pr-[30px] pb-2 pt-1">
+ {/* Symmetric: the extra right inset mirrored the viewport's one-sided
+ scrollbar gutter, which is now reserved on both edges. */}
+ <div className="shrink-0 bg-background pl-5 pr-5 md:px-[30px] pb-2 pt-1">
<div className="mx-auto w-full max-w-[48rem]">{composer}</div>
{showModelDisclaimer && (
<p className="composer-footer-note">
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 3941dccd333..3e6213ca14c 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -3249,8 +3249,10 @@ html[data-chat-font] .aui-root {
.aui-thread-viewport {
scrollbar-color: oklch(0.5 0 0 / 0.54) var(--sidebar);
/* Reserve scrollbar space always so absolute-positioned overlays (topbar)
- can stop flush with the gutter edge without covering the scrollbar. */
- scrollbar-gutter: stable;
+ can stop flush with the gutter edge without covering the scrollbar.
+ both-edges: a one-sided gutter pushes the centred column off-centre by
+ half the scrollbar, and away from the dock, which sits outside here. */
+ scrollbar-gutter: stable both-edges;
}
/* An unregistered custom property always inherits, so writing
diff --git a/studio/frontend/tests/chat-column-centering.test.ts b/studio/frontend/tests/chat-column-centering.test.ts
new file mode 100644
index 00000000000..91ad367e9f1
--- /dev/null
+++ b/studio/frontend/tests/chat-column-centering.test.ts
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { readSrcAsync } from "./helpers/kit.ts";
+
+// The chat column is centred by margin, so every inset around it has to be
+// symmetric. A one-sided scrollbar gutter counts as an inset.
+
+test("the thread viewport reserves its scrollbar gutter on both edges", async () => {
+ const css = await readSrcAsync("index.css");
+
+ const at = css.indexOf(".aui-thread-viewport {");
+ assert.notEqual(at, -1);
+ const rule = css.slice(at, css.indexOf("}", at));
+ assert.match(rule, /scrollbar-gutter:\s*stable both-edges;/);
+
+ // Messages sit inside this viewport, the dock outside it. A one-sided
+ // gutter offsets only the first, so they stop agreeing with each other.
+ assert.doesNotMatch(rule, /scrollbar-gutter:\s*stable;/);
+});
+
+test("nothing around the composer re-adds a one-sided inset", async () => {
+ const chatPage = await readSrcAsync("features/chat/chat-page.tsx");
+ const thread = await readSrcAsync("components/assistant-ui/thread.tsx");
+
+ // The compare-mode wrapper mirrored the old one-sided gutter.
+ assert.doesNotMatch(chatPage, /pl-5 pr-5 md:pr-\[30px\]/);
+ assert.match(chatPage, /pl-5 pr-5 md:px-\[30px\]/);
+
+ // The dock's own padding stays even.
+ assert.match(thread, /unsloth-composer-dock-inner relative px-5/);
+
+ // The dock offset keeps the bottom fade off the scrollbar, so it stays,
+ // but one-sided it also shifts the composer half its width off centre.
+ assert.match(thread, /aui-thread-composer-dock[^"]*md:left-\[10px\] md:right-\[10px\]/);
+ assert.doesNotMatch(thread, /aui-thread-composer-dock[^"]*right-0 md:right-\[10px\]"/);
+});