Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Sidebar: cap the + menu by the window below md too

AdityaUmale75e5aed782eb
diff --git a/src/components/Sidebar.plus-menu.test.ts b/src/components/Sidebar.plus-menu.test.ts
index a2e3414881..163fd059bd 100644
--- a/src/components/Sidebar.plus-menu.test.ts
+++ b/src/components/Sidebar.plus-menu.test.ts
@@ -95,6 +95,8 @@ describe("the sidebar's + menu with a long bot name (simple mode)", () => {
const menu = withLongBot().find((node) => node.props.role === "menu")!;
expect(menu.props.className).toContain("right-0");
expect(menu.props.className).toContain("md:max-w-[calc(min(var(--sidebar-width),var(--sidebar-max))_-_48px)]");
+ // Below md the sidebar fills the window, so the menu is capped by the window instead.
+ expect(menu.props.className).toMatch(/(^|\s)max-w-\[calc\(100vw_-_48px\)\]/);
});
it("caps the menu by the sidebar's own cap, which is narrower than a saved width while a side panel is open", () => {
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 62fdf8510d..d56c6f3161 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1163,7 +1163,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =
<>
<div role="menu" aria-label={remoteClient ? t("sidebar.new") : t("sidebar.newOrShare")} onKeyDown={navigateThreadMenu} className={cn(
"absolute z-40 w-max min-w-[200px] overflow-hidden", MENU_SHEET,
- rail ? "left-full top-0 ml-4" : cn("top-full", advanced ? "mt-1" : "mt-1.5", density === "icons" ? "left-0" : "right-0 md:max-w-[calc(min(var(--sidebar-width),var(--sidebar-max))_-_48px)]"),
+ rail ? "left-full top-0 ml-4" : cn("top-full", advanced ? "mt-1" : "mt-1.5", density === "icons" ? "left-0" : "right-0 max-w-[calc(100vw_-_48px)] md:max-w-[calc(min(var(--sidebar-width),var(--sidebar-max))_-_48px)]"),
plusMotion.className,
)} {...plusMotion.exitProps}>
{advanced && <button