diff --git a/packages/components/src/spectrum/ItemTooltip.scss b/packages/components/src/spectrum/ItemTooltip.scss index 33001f5942..06001ff0c9 100644 --- a/packages/components/src/spectrum/ItemTooltip.scss +++ b/packages/components/src/spectrum/ItemTooltip.scss @@ -13,7 +13,7 @@ * This will not work in Tooltips where there isn't a wrapping ListViewItem, so * we copy the necessary styles. */ -.dh-item-tooltip-description { +.dh-item-tooltip-text-description { color: var(--item-tooltip-description-color); font-size: var(--item-tooltip-description-font-size); } diff --git a/packages/components/src/spectrum/ItemTooltip.tsx b/packages/components/src/spectrum/ItemTooltip.tsx index 2b6823ebf2..bb8f7f0ce9 100644 --- a/packages/components/src/spectrum/ItemTooltip.tsx +++ b/packages/components/src/spectrum/ItemTooltip.tsx @@ -27,20 +27,20 @@ export function ItemTooltip({ isElementOfType(node, Text) ); + const textElementsWithCssClass = Children.map(textElements, textEl => + cloneElement(textEl, { + ...textEl.props, + UNSAFE_className: cl( + textEl.props.UNSAFE_className, + `dh-item-tooltip-text-${textEl.props.slot ?? 'label'}` + ), + }) + ); + return ( - {Children.map(textElements, textEl => - textEl.props.slot === 'description' - ? cloneElement(textEl, { - ...textEl.props, - UNSAFE_className: cl( - textEl.props.UNSAFE_className, - 'dh-item-tooltip-description' - ), - }) - : textEl - )} + {textElementsWithCssClass} );