fix(webui): stabilize transcript menu interactions

This commit is contained in:
yiling
2026-12-04 23:27:44 +08:00
parent 3e81550a81
commit cfda8e9a0e
6 changed files with 49 additions and 12 deletions
@@ -95,6 +95,7 @@ function ContextMenuContent({
function ContextMenuItem({
className,
inset,
onPointerUp,
variant = 'default',
...props
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
@@ -106,6 +107,11 @@ function ContextMenuItem({
data-slot="context-menu-item"
data-inset={inset}
data-variant={variant}
onPointerUp={(event) => {
// Radix can synthesize a click when the button that opened the menu is released.
if (event.button !== 0) event.preventDefault()
onPointerUp?.(event)
}}
className={cn(
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
className,