Skip to content

Commit 0fc0c45

Browse files
fix(web): the citation comment box opens at the quote instead of sliding in from the corner
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 6577c6b commit 0fc0c45

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎apps/web/src/components/chat/AssistantCitationChip.browser.test.tsx‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@ describe("citation comment source disappearance", () => {
129129
});
130130

131131
describe("citation comment popup position", () => {
132+
it("opens at its anchor instead of sliding in from the window corner", async () => {
133+
using source = setup();
134+
await using _screen = await mount(
135+
source.sourceAnchor,
136+
vi.fn(() => true),
137+
);
138+
const positioner = () =>
139+
document.querySelector<HTMLElement>('[data-slot="popover-positioner"]');
140+
await vi.waitFor(() => expect(positioner()?.style.opacity).not.toBe("0"));
141+
142+
const moves = positioner()!
143+
.getAnimations()
144+
.filter(
145+
(animation) =>
146+
animation instanceof CSSTransition &&
147+
["transform", "top", "left"].includes(animation.transitionProperty),
148+
);
149+
expect(moves).toEqual([]);
150+
});
151+
132152
it("stays on screen when the cited text ends in a code block's hidden overflow", async () => {
133153
using _source = setup();
134154
const message = document.createElement("div");

‎apps/web/src/components/ui/popover.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ function PopoverPopup({
7878
collisionAvoidance={collisionAvoidance}
7979
collisionPadding={variant === "panel" ? 0 : undefined}
8080
className={cn(
81-
"h-(--positioner-height) max-h-(--available-height) w-(--positioner-width) max-w-(--available-width) transition-transform data-instant:transition-none",
81+
"h-(--positioner-height) max-h-(--available-height) w-(--positioner-width) max-w-(--available-width)",
82+
// Kept-mounted positioners first paint at the window origin, so a transform transition slides them in from there.
83+
!keepMounted && "transition-transform data-instant:transition-none",
8284
variant === "panel"
8385
? "z-(--z-sheet) w-[min(calc(var(--thread-details-panel-width)+--spacing(4)),calc(var(--anchor-width)---spacing(2)))] transition-[top] duration-150 ease-out data-instant:transition-[top] motion-reduce:transition-none motion-reduce:data-instant:transition-none"
8486
: "z-[130]",

0 commit comments

Comments
 (0)