💩 Apply focus capture workaround to dropdown menu trigger (#1109)

#2565
This commit is contained in:
Luke Vella 2024-05-18 13:32:34 +08:00 committed by GitHub
parent 469fa9bdb2
commit acbb6e552f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;