fix(chat): anchor the More popover outside the tooltip chain (#1862)
Quality / check (pull_request) Canceled after 0s
ci/woodpecker/pr/quality Pipeline was canceled

Nested inside TooltipTrigger as-child, PopoverTrigger's PopperAnchor ref
resolved to a component object instead of the button, so the popover never
became positioned and its content stayed parked off-screen at
translate(0, -200%): the menu opened in state only, invisible to the user.
Wrapping the tooltip in an explicit PopoverAnchor makes the anchor the real
button element, so the menu renders beside it. The tooltip (accessible name
More), the menu items, and the rename/branch dialog are unchanged.

Adds ui/test/chat-more-menu.test.ts, a browser behaviour check (vite dev
server + headless Chrome over CDP, API mocked in-page) that fails on the old
nesting with the menu at (0, -526) and passes with it in the viewport; it
skips when no Chrome binary is installed.
This commit is contained in:
sam committed 2026-11-13 00:40:53 +11:00
1 parent 98941c20a0
commit 82ca9613c7
2 files changed
+355 -15

No files matched your search

+22 -15
View File
@@ -16,6 +16,7 @@ import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import {
Popover,
PopoverAnchor,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
@@ -100,21 +101,27 @@ function submitPrompt(): void {
<template>
<Popover v-model:open="open">
<Tooltip>
<TooltipTrigger as-child>
<PopoverTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
aria-label="More"
>
<Ellipsis />
</Button>
</PopoverTrigger>
</TooltipTrigger>
<TooltipContent>More</TooltipContent>
</Tooltip>
<!-- The anchor sits outside the tooltip chain on purpose: nested inside
TooltipTrigger, the popper anchor ref resolves to a component object
rather than the button, the content is never positioned, and the menu
stays parked off-screen. -->
<PopoverAnchor as-child>
<Tooltip>
<TooltipTrigger as-child>
<PopoverTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
class="flex-none"
aria-label="More"
>
<Ellipsis />
</Button>
</PopoverTrigger>
</TooltipTrigger>
<TooltipContent>More</TooltipContent>
</Tooltip>
</PopoverAnchor>
<PopoverContent align="end" class="grid w-64 gap-0.5 p-1">
<template v-if="currentSession">
<Button