diff --git a/packages/lib/src/base-menu/ItemAction.tsx b/packages/lib/src/base-menu/ItemAction.tsx index 9dd1faf25..c402126de 100644 --- a/packages/lib/src/base-menu/ItemAction.tsx +++ b/packages/lib/src/base-menu/ItemAction.tsx @@ -92,7 +92,7 @@ const ItemAction = memo( const { depthLevel, selected, href, label, icon, collapseIcon, "aria-pressed": ariaPressed, ...rest } = props; return getWrapper( - + { const hasTooltip = useContext(TooltipContext); - return ( {label && !hasTooltip ? ( - + {hasAdditionalContainer ? {children} : children} @@ -128,6 +128,8 @@ export const Tooltip = ({ + ) : isValidElement(children) ? ( + cloneElement(children, { ...rest }) ) : ( children )} @@ -135,8 +137,16 @@ export const Tooltip = ({ ); }; -export const TooltipWrapper = ({ condition, children, label }: TooltipWrapperProps) => - condition ? {children} : <>{children}; +export const TooltipWrapper = ({ condition, children, label, ...rest }: TooltipWrapperProps) => + condition ? ( + + {children} + + ) : isValidElement(children) ? ( + cloneElement(children, { ...rest }) + ) : ( + children + ); const DxcTooltip = (props: TooltipPropsType) => ;