Skip to content

Commit 620d91d

Browse files
fix(web): keep disabled menu items as direct children of MenuRadioGroup
1 parent 0f70b17 commit 620d91d

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

‎apps/web/src/routes/_chat.pull-requests.tsx‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,29 +1640,33 @@ function CompactFilterMenu<Value extends string>({
16401640
</MenuTrigger>
16411641
<MenuPopup align="start" side="bottom" className="min-w-40">
16421642
<MenuRadioGroup value={value} onValueChange={(next) => onChange(next as Value)}>
1643-
{options.map((option) => (
1644-
<Tooltip key={option.value}>
1645-
<TooltipTrigger render={<span className="block" />}>
1646-
<MenuRadioItem
1647-
value={option.value}
1648-
// A host the server has already said it cannot read is not a choice here either.
1649-
// The pills disable it; a menu that offers it would answer the press by replacing
1650-
// a working list with the same failure the pill row exists to explain.
1651-
disabled={option.unavailable !== undefined}
1652-
>
1653-
<span className="flex min-w-0 items-center gap-2">
1654-
<option.Icon aria-hidden className="size-3.5" />
1655-
{option.label}
1656-
</span>
1657-
</MenuRadioItem>
1658-
</TooltipTrigger>
1659-
{option.unavailable ? (
1643+
{options.map((option) => {
1644+
// A host the server has already said it cannot read is not a choice here either.
1645+
// The pills disable it; a menu that offers it would answer the press by replacing
1646+
// a working list with the same failure the pill row exists to explain.
1647+
const item = (
1648+
<MenuRadioItem
1649+
key={option.value}
1650+
value={option.value}
1651+
className={option.unavailable ? "data-disabled:pointer-events-auto" : undefined}
1652+
disabled={option.unavailable !== undefined}
1653+
>
1654+
<span className="flex min-w-0 items-center gap-2">
1655+
<option.Icon aria-hidden className="size-3.5" />
1656+
{option.label}
1657+
</span>
1658+
</MenuRadioItem>
1659+
);
1660+
if (!option.unavailable) return item;
1661+
return (
1662+
<Tooltip key={option.value}>
1663+
<TooltipTrigger render={item} />
16601664
<TooltipPopup side="top" className="max-w-80">
16611665
{option.unavailable}
16621666
</TooltipPopup>
1663-
) : null}
1664-
</Tooltip>
1665-
))}
1667+
</Tooltip>
1668+
);
1669+
})}
16661670
</MenuRadioGroup>
16671671
</MenuPopup>
16681672
</Menu>

0 commit comments

Comments
 (0)