diff --git a/web/src/components/ui/dropdown/Dropdown.stories.tsx b/web/src/components/ui/dropdown/Dropdown.stories.tsx index 0785ab380..b7578b4cb 100644 --- a/web/src/components/ui/dropdown/Dropdown.stories.tsx +++ b/web/src/components/ui/dropdown/Dropdown.stories.tsx @@ -210,7 +210,7 @@ export const WithSelection: Story = { { id: '1', label: 'Option 1', - selected: true, + selected: false, onClick: () => console.log('Option 1 clicked') }, { @@ -220,8 +220,9 @@ export const WithSelection: Story = { }, { id: '3', - label: 'Option 3', - onClick: () => console.log('Option 3 clicked') + label: 'Option 3 - Selected', + onClick: () => console.log('Option 3 clicked'), + selected: true } ], children: diff --git a/web/src/components/ui/dropdown/Dropdown.tsx b/web/src/components/ui/dropdown/Dropdown.tsx index a945f1c77..d853e5dea 100644 --- a/web/src/components/ui/dropdown/Dropdown.tsx +++ b/web/src/components/ui/dropdown/Dropdown.tsx @@ -160,6 +160,7 @@ const DropdownItem = ({ diff --git a/web/src/components/ui/dropdown/DropdownBase.tsx b/web/src/components/ui/dropdown/DropdownBase.tsx index 85c699b14..378dc2b4a 100644 --- a/web/src/components/ui/dropdown/DropdownBase.tsx +++ b/web/src/components/ui/dropdown/DropdownBase.tsx @@ -105,8 +105,11 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + closeOnSelect?: boolean; + selectType?: string; + } +>(({ className, children, onClick, checked, closeOnSelect, selectType, ...props }, ref) => ( { + if (closeOnSelect) { + e.stopPropagation(); + e.preventDefault(); + } + onClick?.(e); + }} {...props}>