Skip to content

Commit b3bbabc

Browse files
committed
Add hideWhenDetached
1 parent 85eff52 commit b3bbabc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/gitbook/src/components/Header/DropdownMenu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function DropdownMenu(props: {
5151
<RadixDropdownMenu.Portal>
5252
<RadixDropdownMenu.Content
5353
data-testid="dropdown-menu"
54+
hideWhenDetached
5455
collisionPadding={8}
5556
onMouseEnter={() => setHovered(true)}
5657
onMouseLeave={() => setHovered(false)}
@@ -160,7 +161,11 @@ export function DropdownSubMenu(props: { children: React.ReactNode; label: React
160161
<Icon icon="chevron-right" className="size-3 shrink-0 opacity-6" />
161162
</RadixDropdownMenu.SubTrigger>
162163
<RadixDropdownMenu.Portal>
163-
<RadixDropdownMenu.SubContent collisionPadding={8} className="z-40 animate-present">
164+
<RadixDropdownMenu.SubContent
165+
hideWhenDetached
166+
collisionPadding={8}
167+
className="z-40 animate-present"
168+
>
164169
<div className="flex max-h-80 min-w-40 max-w-[40vw] flex-col gap-1 overflow-auto rounded-lg straight-corners:rounded-sm bg-tint-base p-2 shadow-lg ring-1 ring-tint-subtle sm:min-w-52 sm:max-w-80">
165170
{children}
166171
</div>

0 commit comments

Comments
 (0)