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: open model row tooltips from the name only (#11985)

Michael Hanc8bb6bfb0a92
diff --git a/studio/frontend/src/components/ui/tooltip.tsx b/studio/frontend/src/components/ui/tooltip.tsx
index ae56db7c9b5..b9cac4d7ca0 100644
--- a/studio/frontend/src/components/ui/tooltip.tsx
+++ b/studio/frontend/src/components/ui/tooltip.tsx
@@ -18,6 +18,7 @@ import {
subscribeModalLayer,
} from "@/components/ui/tooltip-modal-layer";
import { resolveTooltipOpen } from "@/components/ui/tooltip-open-state";
+import { isTouchClick } from "@/components/ui/touch-click";
import { cn } from "@/lib/utils";
type ToggleFn = () => void;
@@ -85,20 +86,6 @@ function getServerModalBlock(): boolean {
return false;
}
-/** Tap-to-pin is for touch, which has no hover. The click's own pointerType is the only thing
-* that answers for the pointer actually used: the media query reports the primary device, so on
-* a hybrid it mislabels every event. Keyboard activation reports "", which correctly does not pin. */
-function isTouchClick(event: React.MouseEvent): boolean {
- const pointerType = (event.nativeEvent as Partial<PointerEvent>).pointerType;
- if (typeof pointerType === "string") return pointerType === "touch";
- // No PointerEvent (older WebViews): fall back to the device class.
- return (
- typeof window !== "undefined" &&
- typeof window.matchMedia === "function" &&
- window.matchMedia("(pointer: coarse)").matches
- );
-}
-
// Default to instant open (no hover delay): icon labels, nav labels and the token calculators
// should feel snappy. Consumers that want a delay pass an explicit `delayDuration`.
function TooltipProvider({
diff --git a/studio/frontend/src/components/ui/touch-click.ts b/studio/frontend/src/components/ui/touch-click.ts
new file mode 100644
index 00000000000..1b988397c5c
--- /dev/null
+++ b/studio/frontend/src/components/ui/touch-click.ts
@@ -0,0 +1,18 @@
+// 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 type * as React from "react";
+
+/** Tap-to-pin is for touch, which has no hover. The click's own pointerType is the only thing
+* that answers for the pointer actually used: the media query reports the primary device, so on
+* a hybrid it mislabels every event. Keyboard activation reports "", which correctly does not pin. */
+export function isTouchClick(event: React.MouseEvent): boolean {
+ const pointerType = (event.nativeEvent as Partial<PointerEvent>).pointerType;
+ if (typeof pointerType === "string") return pointerType === "touch";
+ // No PointerEvent (older WebViews): fall back to the device class.
+ return (
+ typeof window !== "undefined" &&
+ typeof window.matchMedia === "function" &&
+ window.matchMedia("(pointer: coarse)").matches
+ );
+}
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
index d8c094ebfd6..084e95900ab 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
@@ -13,6 +13,7 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
+import { isTouchClick } from "@/components/ui/touch-click";
import { usePlatformStore } from "@/config/env";
import { INVENTORY_FRESHNESS_WINDOW_MS } from "@/features/hub/inventory";
import { ApiProviderLogo } from "@/features/chat";
@@ -1193,6 +1194,84 @@ function ModelRow({
const memorySegments = useModelMemory(selected ? memory : undefined, gpuGb);
const showMemoryBar = memorySegments.status !== "unknown";
+ // Tooltip opens from the name or keyboard focus only, not the whole row.
+ const nameRef = useRef<HTMLSpanElement>(null);
+ const nameHoverTimer = useRef<number | undefined>(undefined);
+ const [tooltipOpen, setTooltipOpen] = useState(false);
+ // Touch has no hover, so a tap on the name opens it and a tap elsewhere closes it.
+ const [tappedOpen, setTappedOpen] = useState(false);
+ useEffect(() => () => window.clearTimeout(nameHoverTimer.current), []);
+ useEffect(() => {
+ if (!tappedOpen) return;
+ const release = (event: Event) => {
+ const target = event.target as Element | null;
+ if (nameRef.current?.contains(target)) return;
+ if (target?.closest?.('[data-slot="tooltip-content"]')) return;
+ setTappedOpen(false);
+ setTooltipOpen(false);
+ };
+ // touchstart covers WebViews without pointer events.
+ document.addEventListener("pointerdown", release, true);
+ document.addEventListener("touchstart", release, { capture: true, passive: true });
+ return () => {
+ document.removeEventListener("pointerdown", release, true);
+ document.removeEventListener("touchstart", release, true);
+ };
+ }, [tappedOpen]);
+ const onNameEnter = (event: React.PointerEvent) => {
+ if (event.pointerType === "touch") return;
+ window.clearTimeout(nameHoverTimer.current);
+ nameHoverTimer.current = window.setTimeout(() => setTooltipOpen(true), 700);
+ };
+ const onNameLeave = () => {
+ window.clearTimeout(nameHoverTimer.current);
+ setTappedOpen(false);
+ setTooltipOpen(false);
+ };
+ // Keyboard focus opened it, so the pointer leaving the name does not close it.
+ const onNamePointerLeave = (event: React.PointerEvent) => {
+ if (event.pointerType === "touch") return;
+ if (nameRef.current?.closest("button")?.matches(":focus-visible")) {
+ window.clearTimeout(nameHoverTimer.current);
+ return;
+ }
+ onNameLeave();
+ };
+ // Read at pointerdown: the trigger closes an open tooltip before the click lands.
+ // Null without pointer events, where nothing closes it first.
+ const openAtTap = useRef<boolean | null>(null);
+ const onNameDown = (event: React.PointerEvent) => {
+ if (event.pointerType === "touch") openAtTap.current = tooltipOpen;
+ };
+ const hasTooltip = Boolean(vramTooltipText || tooltipText || hubUrl || formatDot);
+ // Like hover on iOS: the first tap shows the details, the next one picks the row.
+ const onNameClick = (event: React.MouseEvent) => {
+ const wasOpen = openAtTap.current ?? tooltipOpen;
+ openAtTap.current = null;
+ if (!hasTooltip || !isTouchClick(event)) return;
+ if (wasOpen) {
+ onNameLeave();
+ return;
+ }
+ event.stopPropagation();
+ setTappedOpen(true);
+ setTooltipOpen(true);
+ };
+ const onTooltipOpenChange = (next: boolean) => {
+ if (!next) {
+ onNameLeave();
+ return;
+ }
+ const focused = document.activeElement;
+ if (
+ focused?.matches(":focus-visible") &&
+ nameRef.current &&
+ focused.contains(nameRef.current)
+ ) {
+ setTooltipOpen(true);
+ }
+ };
+
const content = (
<button
type="button"
@@ -1245,7 +1324,17 @@ function ModelRow({
<span className="shrink-0 text-muted-foreground/80">/</span>
</span>
) : null}
- <span className="min-w-0 flex-1 truncate">{name}</span>
+ <span className="min-w-0 flex-1 truncate">
+ <span
+ ref={nameRef}
+ onPointerEnter={onNameEnter}
+ onPointerDown={onNameDown}
+ onPointerLeave={onNamePointerLeave}
+ onClick={onNameClick}
+ >
+ {name}
+ </span>
+ </span>
{/* Here it eats name width instead of moving the meta columns. self-center: on the
baseline the empty dot sat the tag low. */}
{aligned && loaded && (
@@ -1424,7 +1513,7 @@ function ModelRow({
if (tooltipBody) {
return (
- <Tooltip delayDuration={700}>
+ <Tooltip open={tooltipOpen} onOpenChange={onTooltipOpenChange}>
<TooltipTrigger asChild={true}>{content}</TooltipTrigger>
{/* Right, not left: this panel is docked to the model button at the window's left edge,
so a row's own left edge is ~30px in and a tooltip opening that way ran off screen.