fix(webui): anchor floating surface animations (#6722)

* fix(webui): anchor floating surface animations

* test(webui): assert the dispatched file menu click coordinate
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-19 15:05:42 +08:00
1 parent eb82ab84cc
commit 32bba3a16c
7 files changed
+80 -4

No files matched your search

+3 -1
View File
@@ -114,7 +114,7 @@ export function FileActions({
<Menu.Portal container={portal ?? undefined}>
<Menu.Content aria-label={t("fileActions.menu", { name: path.split(/[\\/]/).pop() || path })}
align="start" sideOffset={4} collisionPadding={12}
className={cn(floatingSurfaceClassName, floatingSurfaceMotionClassName, "min-w-40 rounded-control p-1 [&_[role=menuitem]]:py-1.5")}
className={cn(floatingSurfaceClassName, floatingSurfaceMotionClassName, "min-w-40 origin-[var(--radix-popper-transform-origin)] rounded-control p-1 [&_[role=menuitem]]:py-1.5")}
onClick={(event) => event.stopPropagation()}
onContextMenu={(event) => { event.preventDefault(); event.stopPropagation(); }}
onInteractOutside={() => { interactedOutside.current = true; }}
@@ -122,6 +122,8 @@ export function FileActions({
event.preventDefault();
if (!interactedOutside.current) opener.current?.focus();
}}>
{/* Track the click point even when collision handling shifts the menu; render no visible arrow. */}
<Menu.Arrow width={0} height={0} aria-hidden />
<Menu.Item className={itemClassName} disabled={!resolved} onSelect={(event) => {
event.preventDefault();
if (resolved) void copy(resolved.path);
@@ -434,7 +434,6 @@ export function ModelPresetBadge({
className={cn(
showsSpeedControl ? speedPickerWidthClassName : pickerWidthClassName,
"inset-scrollbar flex max-h-[var(--radix-popover-content-available-height)] flex-col overflow-y-auto",
"origin-[var(--radix-popover-content-transform-origin)] p-1.5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-bottom-1 data-[state=open]:slide-in-from-bottom-1 duration-200 ease-out motion-reduce:animate-none",
)}
>
<div
@@ -23,7 +23,7 @@ const TooltipContent = React.forwardRef<
sideOffset={sideOffset}
className={cn(
floatingSurfaceElevationClassName,
"z-50 overflow-hidden rounded-control px-3 py-1.5 text-caption animate-in fade-in-0 zoom-in-95",
"z-50 origin-[var(--radix-tooltip-content-transform-origin)] overflow-hidden rounded-control px-3 py-1.5 text-caption animate-in fade-in-0 zoom-in-95 motion-reduce:animate-none",
className,
)}
{...props}