Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(layout): size the app shell from available space, not 100vw (#16081)

Nikita Kabardin85e7a19a3880
diff --git a/web/src/__e2e__/app-shell-overflow.spec.ts b/web/src/__e2e__/app-shell-overflow.spec.ts
index 37bde5b9f4..41631f5016 100644
--- a/web/src/__e2e__/app-shell-overflow.spec.ts
+++ b/web/src/__e2e__/app-shell-overflow.spec.ts
@@ -52,3 +52,29 @@ test("a right drawer's absolutely-positioned content does not scroll the documen
expect(await documentOverflow(page)).toEqual({ y: 0, x: 0 });
});
+
+test("a vertical document scrollbar does not spawn a horizontal one", async ({
+ page,
+}) => {
+ await page.setViewportSize(SHORT_VIEWPORT);
+ await signIn(page);
+ // Viewport units ignore scrollbars, so a shell sized off `100vw` overshoots
+ // the space beside the sidebar by the scrollbar's width once one is showing.
+ // Sizing `::-webkit-scrollbar` opts out of overlay scrollbars where the
+ // platform defaults to them, the way Windows and Linux behave natively.
+ await page.addStyleTag({
+ content: "::-webkit-scrollbar { width: 15px; height: 15px }",
+ });
+ await page.evaluate(() => {
+ document.documentElement.style.overflowY = "scroll";
+ });
+ const scrollbarWidth = await page.evaluate(
+ () => window.innerWidth - document.documentElement.clientWidth,
+ );
+ test.skip(
+ scrollbarWidth === 0,
+ "this browser refuses space-taking scrollbars, so there is nothing to overshoot",
+ );
+
+ expect((await documentOverflow(page)).x).toBe(0);
+});
diff --git a/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx b/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
index af0717d25e..51562ff632 100644
--- a/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
+++ b/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
@@ -266,7 +266,13 @@ export function AuthenticatedLayout({
: undefined
}
/>
- <SidebarInset className="h-screen-with-banner max-w-full md:peer-data-[state=collapsed]:w-[calc(100vw-var(--sidebar-width-icon))] md:peer-data-[state=expanded]:w-[calc(100vw-var(--sidebar-width))]">
+ {/* `min-w-0`, not a `100vw`-derived width: viewport units ignore
+ scrollbars, and a definite width also floors `min-width:
+ auto`, so on a wide page the inset stayed pinned 15px past
+ the space beside the sidebar once a space-taking vertical
+ scrollbar showed — spawning a horizontal one. Flex already
+ sizes the inset to that space. */}
+ <SidebarInset className="h-screen-with-banner max-w-full min-w-0">
<AppContentWithRightDrawer>
{children}
</AppContentWithRightDrawer>