The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 09:30 UTC
fix(web): popovers fade out in place instead of jumping after a pick (#26716)
oliver committed
Oct 31, 2026 at 01:33 UTC
09ac55639a39efe709b3329ccbeee76a788ecaca
3 files changed
+23
apps/web/src/components/ui/closing-positioner.tsx
new
+18
@@ -0,0 +1,18 @@
1
+import { useState, type ComponentProps, type CSSProperties } from "react";
2
+
3
+const PLACEMENT_KEYS = ["position", "top", "right", "bottom", "left", "transform"] as const;
4
+
5
+type Placement = Pick<CSSProperties, (typeof PLACEMENT_KEYS)[number]>;
6
+
7
+function ClosingPositioner({ open, style, ...props }: ComponentProps<"div"> & { open: boolean }) {
8
+ const [openPlacement, setOpenPlacement] = useState<Placement>({});
9
+ if (open && style && PLACEMENT_KEYS.some((key) => style[key] !== openPlacement[key])) {
10
+ const { position, top, right, bottom, left, transform } = style;
11
+ setOpenPlacement({ position, top, right, bottom, left, transform });
12
+ }
13
+ return <div {...props} style={open ? style : { ...style, ...openPlacement }} />;
14
+}
15
+
16
+export function renderClosingPositioner(props: ComponentProps<"div">, state: { open: boolean }) {
17
+ return <ClosingPositioner {...props} open={state.open} />;
18
+}
apps/web/src/components/ui/menu.tsx
+2
@@ -4,6 +4,7 @@ import type * as React from "react";
4
5
import { cn } from "~/lib/utils";
6
import { buttonVariants } from "./button";
7
+import { renderClosingPositioner } from "./closing-positioner";
8
import { Input, type InputProps } from "./input";
9
import { Spinner } from "./spinner";
10
@@ -45,6 +46,7 @@ function MenuPopup({
46
anchor={anchor}
47
className="z-[130]"
48
data-slot="menu-positioner"
49
+ render={renderClosingPositioner}
50
side={side}
51
sideOffset={sideOffset}
52
>
apps/web/src/components/ui/popover.tsx
+3
@@ -2,6 +2,8 @@ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
2
3
import { cn } from "~/lib/utils";
4
5
+import { renderClosingPositioner } from "./closing-positioner";
6
+
7
const PopoverCreateHandle = PopoverPrimitive.createHandle;
8
9
const Popover = PopoverPrimitive.Root;
@@ -82,6 +84,7 @@ function PopoverPopup({
84
: "z-[130]",
85
)}
86
data-slot="popover-positioner"
87
+ render={renderClosingPositioner}
88
side={side}
89
sideOffset={sideOffset}
90
>