Fix menu item toggle (#17338)
## Before https://github.com/user-attachments/assets/c26ad780-3a6a-4ccf-91a9-1c7e1bd1413d ## After https://github.com/user-attachments/assets/40f951c7-6bcf-45a3-98bc-c631f5ec883b
This commit is contained in:
@@ -38,11 +38,18 @@ export const MenuItemToggle = ({
|
||||
toggleSize,
|
||||
disabled = false,
|
||||
}: MenuItemToggleProps) => {
|
||||
const handleClick = () => {
|
||||
if (!disabled) {
|
||||
onToggleChange?.(!toggled);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledMenuItemBase
|
||||
className={className}
|
||||
focused={focused}
|
||||
disabled={disabled}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<StyledToggleContainer>
|
||||
<MenuItemLeftContent
|
||||
@@ -51,7 +58,7 @@ export const MenuItemToggle = ({
|
||||
withIconContainer={withIconContainer}
|
||||
disabled={disabled}
|
||||
/>
|
||||
<StyledMenuItemRightContent>
|
||||
<StyledMenuItemRightContent onClick={(e) => e.stopPropagation()}>
|
||||
<Toggle
|
||||
value={toggled}
|
||||
onChange={disabled ? undefined : onToggleChange}
|
||||
|
||||
Reference in New Issue
Block a user