mirror of
https://github.com/block/buzz.git
synced 2026-11-04 00:12:02 +00:00
Prevent profile popover from reopening on panel click
Use the popover as a hover anchor so clicking an avatar opens the profile panel without toggling the hover card back open. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,7 +13,7 @@ import { rewriteRelayUrl } from "@/shared/lib/mediaUrl";
|
||||
import { useAgentSession } from "@/shared/context/AgentSessionContext";
|
||||
import { useProfilePanel } from "@/shared/context/ProfilePanelContext";
|
||||
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/shared/ui/popover";
|
||||
import { Popover, PopoverAnchor, PopoverContent } from "@/shared/ui/popover";
|
||||
import { BotIdenticon } from "@/features/messages/ui/BotIdenticon";
|
||||
|
||||
type UserProfilePopoverProps = {
|
||||
@@ -135,7 +135,7 @@ export function UserProfilePopover({
|
||||
|
||||
return (
|
||||
<Popover onOpenChange={setOpen} open={open}>
|
||||
<PopoverTrigger asChild>
|
||||
<PopoverAnchor asChild>
|
||||
{/* biome-ignore lint/a11y/useSemanticElements: wrapper div for hover/click behavior */}
|
||||
<div
|
||||
role="button"
|
||||
@@ -156,7 +156,7 @@ export function UserProfilePopover({
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</PopoverTrigger>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className="w-80"
|
||||
|
||||
@@ -157,11 +157,13 @@ test("hovering avatar opens popover, clicking opens profile panel", async ({
|
||||
|
||||
// Hover should open the popover
|
||||
await avatarButton.hover();
|
||||
const profilePopover = page.getByTestId("user-profile-popover");
|
||||
const profilePopover = page.locator(
|
||||
'[data-testid="user-profile-popover"][data-state="open"]',
|
||||
);
|
||||
await expect(profilePopover).toBeVisible();
|
||||
|
||||
// Click should close the popover and open the profile panel
|
||||
await avatarButton.click();
|
||||
await expect(profilePopover).not.toBeVisible();
|
||||
await expect(profilePopover).toHaveCount(0);
|
||||
await expect(page.getByTestId("user-profile-panel")).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user