Skip to content

Commit

Permalink
💩 Apply focus capture workaround to dropdown menu trigger (#1109)
Browse files Browse the repository at this point in the history
#2565
  • Loading branch information
lukevella authored May 18, 2024
1 parent 469fa9b commit acbb6e5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/ui/src/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ import { Icon } from "./icon";

const DropdownMenu = DropdownMenuPrimitive.Root;

const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
const DropdownMenuTrigger = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>
>(({ ...props }, ref) => (
<DropdownMenuPrimitive.Trigger
ref={ref}
{...props}
onFocusCapture={(e) => {
e.stopPropagation();
}}
/>
));

const DropdownMenuGroup = DropdownMenuPrimitive.Group;

Expand Down

0 comments on commit acbb6e5

Please sign in to comment.