diff --git a/packages/components/typography/src/Typography/Typography.tsx b/packages/components/typography/src/Typography/Typography.tsx index 8bec17a1ce..f59fc7f5b0 100644 --- a/packages/components/typography/src/Typography/Typography.tsx +++ b/packages/components/typography/src/Typography/Typography.tsx @@ -84,23 +84,25 @@ const Typography = forwardRef( const overrideAlign = align === "inherit" ? "alignInherit" : align; - return ( - - {React.createElement( - element, - { - id, - style: ellipsisStyle, - "data-testid": dataTestId, - className: cx(styles.typography, styles[color], styles[overrideAlign], ellipsisClass, className), - ref: mergedRef, - role, - ...htmlAttributes - }, - children - )} - + const baseElement = React.createElement( + element, + { + id, + style: ellipsisStyle, + "data-testid": dataTestId, + className: cx(styles.typography, styles[color], styles[overrideAlign], ellipsisClass, className), + ref: mergedRef, + role, + ...htmlAttributes + }, + children ); + + if (!overrideTooltipProps.content) { + return baseElement; + } + + return {baseElement}; } ); diff --git a/packages/components/typography/src/Typography/TypographyHooks.tsx b/packages/components/typography/src/Typography/TypographyHooks.tsx index 79b726c6b1..2e642d1e3d 100644 --- a/packages/components/typography/src/Typography/TypographyHooks.tsx +++ b/packages/components/typography/src/Typography/TypographyHooks.tsx @@ -32,7 +32,7 @@ export function useTooltipProps( overflowTolerance: number ) { const isOverflowing = useIsOverflowing({ - ref: ellipsis ? ref : null, + ref: ellipsis && !withoutTooltip ? ref : null, ignoreHeightOverflow, tolerance: overflowTolerance });