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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix sidebar More menu hover and collapsed border hover (#12216)
Eyera2033855cd742
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex f12956f34aa..792268aaad5 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -1004,39 +1004,12 @@ export function AppSidebar() {const isStudioRoute = pathname === "/studio" || pathname.startsWith("/studio/");const [chatOpen, setChatOpen] = useState(true);- // Hover previews the flyout; a primary click pins that preview open. The trigger owns pointer- // clicks so Radix cannot interpret the already-hover-open menu as a request to close it.- const [moreHoverOpen, setMoreHoverOpen] = useState(false);- const [morePinnedOpen, setMorePinnedOpen] = useState(false);- const moreOpen = moreHoverOpen || morePinnedOpen;- const moreCloseTimer = useRef<ReturnType<typeof setTimeout> | null>(null);- const clearMoreCloseTimer = useCallback(() => {- if (!moreCloseTimer.current) return;- clearTimeout(moreCloseTimer.current);- moreCloseTimer.current = null;+ const [moreOpen, setMoreOpen] = useState(false);+ const [moreTooltipOpen, setMoreTooltipOpen] = useState(false);+ const moreFocusReturning = useRef(false);+ const handleMoreTooltipOpenChange = useCallback((next: boolean) => {+ if (!(next && moreFocusReturning.current)) setMoreTooltipOpen(next);}, []);- const openMorePreview = useCallback(() => {- clearMoreCloseTimer();- setMoreHoverOpen(true);- }, [clearMoreCloseTimer]);- const closeMorePreviewSoon = useCallback(() => {- clearMoreCloseTimer();- moreCloseTimer.current = setTimeout(() => setMoreHoverOpen(false), 180);- }, [clearMoreCloseTimer]);- const handleMoreOpenChange = useCallback((next: boolean) => {- if (next) {- setMorePinnedOpen(true);- return;- }- setMorePinnedOpen(false);- setMoreHoverOpen(false);- }, []);- useEffect(- () => () => {- clearMoreCloseTimer();- },- [clearMoreCloseTimer],- );const [runsOpen, setRunsOpen] = useState(true);useEffect(() => {@@ -5282,17 +5255,17 @@ export function AppSidebar() {})}{/* Unpinned destinations, behind one row. */}{overflowNavIds.length > 0 && (- <SidebarMenuItem- onPointerEnter={openMorePreview}- onPointerLeave={closeMorePreviewSoon}- >+ <SidebarMenuItem><DropdownMenuopen={moreOpen}- onOpenChange={handleMoreOpenChange}+ onOpenChange={setMoreOpen}modal={false}>{/* Tooltip wraps the trigger rather than using the button's `tooltip` prop: that returns a Tooltip root, so DropdownMenuTrigger asChild would miss the DOM node. */}- <Tooltip>+ <Tooltip+ open={moreTooltipOpen && !moreOpen}+ onOpenChange={handleMoreTooltipOpenChange}+ ><TooltipPrimitive.Trigger asChild><DropdownMenuTrigger asChild><SidebarMenuButton@@ -5300,19 +5273,6 @@ export function AppSidebar() {// lives inside it. Keeps the row highlighted while the panel is open, after the pointer// has left. Not data-state: the tooltip and menu triggers both write that one.data-menu-open={moreOpen ? "true" : undefined}- onPointerDownCapture={(event) => {- if (event.button !== 0 || event.ctrlKey) return;- event.preventDefault();- event.stopPropagation();- event.currentTarget.focus({ preventScroll: true });- clearMoreCloseTimer();- if (morePinnedOpen) {- setMorePinnedOpen(false);- setMoreHoverOpen(false);- } else {- setMorePinnedOpen(true);- }- }}className="sidebar-nav-btn h-[calc(33px*var(--ui-space-scale,1))] rounded-full gap-[calc(8.5px*var(--ui-space-scale,1))] pl-3 pr-2.5 font-medium group-data-[collapsible=icon]:!p-0 group-data-[collapsible=icon]:!size-[calc(28px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:my-[calc(2.5px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:mx-auto"><HugeiconsIcon@@ -5341,8 +5301,12 @@ export function AppSidebar() {align="start"sideOffset={6}className="w-48 p-1"- onPointerEnter={openMorePreview}- onPointerLeave={closeMorePreviewSoon}+ onCloseAutoFocus={() => {+ moreFocusReturning.current = true;+ queueMicrotask(() => {+ moreFocusReturning.current = false;+ });+ }}>{overflowNavIds.map((id) => {const row = navRows[id];diff --git a/studio/frontend/src/components/ui/sidebar.tsx b/studio/frontend/src/components/ui/sidebar.tsxindex 756d9ebcd7f..99f9e615c05 100644--- a/studio/frontend/src/components/ui/sidebar.tsx+++ b/studio/frontend/src/components/ui/sidebar.tsx@@ -457,7 +457,7 @@ function Sidebar({>{children}</div>- {(!collapseToZero || pinned) && (+ {state === "expanded" && (!collapseToZero || pinned) && (<SidebarResizeHandleside={side}// The shared handle hides itself below `sm`, a viewport rule thatdiff --git a/studio/frontend/tests/nonmodal-menu-dismiss-guard.test.ts b/studio/frontend/tests/nonmodal-menu-dismiss-guard.test.tsindex f2f47614e9c..88eb2ff9ab9 100644--- a/studio/frontend/tests/nonmodal-menu-dismiss-guard.test.ts+++ b/studio/frontend/tests/nonmodal-menu-dismiss-guard.test.ts@@ -18,10 +18,9 @@ const GUARD = /<MenuDismissGuard\b(?=[^>]*\btriggerRef=\{)[^>]*\/>/;const UNGUARDED = new Map<string, string>([["components/app-sidebar.tsx <DropdownMenu>",- "the sidebar's More flyout opens on POINTER ENTER and stays open for 180ms after the pointer " +- "leaves, so an unconditional swallow eats an ordinary click on the nav row the pointer was " +- "heading for. A press pins it open too, and that path could take one, but the flyout has " +- "been non-modal since #6763 rather than since #8992, so it is a defect of its own.",+ "the sidebar's More flyout sits among the nav rows, and a click on another row while it is " ++ "open should close it and follow that row, which an unconditional swallow would eat. The " ++ "flyout has been non-modal since #6763 rather than since #8992, so it is a defect of its own.",],]);diff --git a/studio/frontend/tests/sidebar-collapsed-edge.test.ts b/studio/frontend/tests/sidebar-collapsed-edge.test.tsnew file mode 100644index 00000000000..5bc938743bd--- /dev/null+++ b/studio/frontend/tests/sidebar-collapsed-edge.test.ts@@ -0,0 +1,16 @@+// 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";++test("a collapsed sidebar renders no resize edge, so its border has no hover or tooltip", async () => {+ const sidebar = await readSrcAsync("components/ui/sidebar.tsx");+ const at = sidebar.indexOf("<SidebarResizeHandle\n");+ assert.notEqual(at, -1, "could not find where the sidebar renders its resize edge");+ const guard = sidebar.slice(sidebar.lastIndexOf("{", at), at);+ assert.match(guard, /state === "expanded"/);+ assert.match(guard, /!collapseToZero \|\| pinned/);+});diff --git a/studio/frontend/tests/sidebar-more-menu-interaction.test.ts b/studio/frontend/tests/sidebar-more-menu-interaction.test.tsindex d25cb45bf86..b078a8e5ec4 100644--- a/studio/frontend/tests/sidebar-more-menu-interaction.test.ts+++ b/studio/frontend/tests/sidebar-more-menu-interaction.test.ts@@ -6,18 +6,22 @@ import test from "node:test";import { readSrcAsync } from "./helpers/kit.ts";-test("the sidebar More flyout previews on hover and pins on click", async () => {+test("the sidebar More flyout opens only on click and hides its tooltip while open", async () => {const source = await readSrcAsync("components/app-sidebar.tsx");+ const start = source.indexOf("{/* Unpinned destinations, behind one row. */}");+ assert.notEqual(start, -1, "could not find the More flyout");+ const flyout = source.slice(start, source.indexOf("</SidebarMenuItem>", start));- assert.match(source, /const \[moreHoverOpen, setMoreHoverOpen\] = useState\(false\)/);- assert.match(source, /const \[morePinnedOpen, setMorePinnedOpen\] = useState\(false\)/);- assert.match(source, /const moreOpen = moreHoverOpen \|\| morePinnedOpen/);- assert.match(source, /open=\{moreOpen\}\s*\n\s*onOpenChange=\{handleMoreOpenChange\}/);- assert.match(source, /<DropdownMenuTrigger asChild>/);- assert.match(source, /onPointerEnter=\{openMorePreview\}/);- assert.match(source, /onPointerLeave=\{closeMorePreviewSoon\}/);- assert.match(source, /onPointerDownCapture=/);- assert.match(source, /event\.preventDefault\(\)/);- assert.match(source, /event\.stopPropagation\(\)/);- assert.match(source, /if \(morePinnedOpen\)/);+ assert.match(source, /const \[moreOpen, setMoreOpen\] = useState\(false\)/);+ assert.match(flyout, /open=\{moreOpen\}\s*\n\s*onOpenChange=\{setMoreOpen\}/);+ assert.match(flyout, /<DropdownMenuTrigger asChild>/);+ assert.match(flyout, /open=\{moreTooltipOpen && !moreOpen\}/);+ assert.match(flyout, /onOpenChange=\{handleMoreTooltipOpenChange\}/);+ assert.match(source, /if \(!\(next && moreFocusReturning\.current\)\) setMoreTooltipOpen\(next\)/);+ assert.match(flyout, /onCloseAutoFocus=\{\(\) => \{\s*moreFocusReturning\.current = true;\s*queueMicrotask\(/);+ assert.doesNotMatch(flyout, /onPointerEnter|onPointerLeave|onPointerDownCapture/);+ assert.doesNotMatch(+ source,+ /openMorePreview|closeMorePreviewSoon|moreHoverOpen|morePinnedOpen/,+ );});