@@ -53,11 +53,7 @@ import {
53
53
Styles ,
54
54
tasty ,
55
55
} from '../../../tasty' ;
56
- import {
57
- mergeProps ,
58
- useCombinedRefs ,
59
- useLayoutEffect ,
60
- } from '../../../utils/react' ;
56
+ import { mergeProps , useCombinedRefs } from '../../../utils/react' ;
61
57
import {
62
58
CubeTooltipProviderProps ,
63
59
TooltipProvider ,
@@ -491,10 +487,10 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
491
487
492
488
// Determine if auto tooltip is enabled
493
489
const isAutoTooltipEnabled = useMemo ( ( ) => {
494
- if ( tooltip === true ) return true ;
490
+ if ( tooltip === true && typeof children === 'string' ) return true ;
495
491
if ( typeof tooltip === 'object' && tooltip ?. auto ) return true ;
496
492
return false ;
497
- } , [ tooltip ] ) ;
493
+ } , [ tooltip , typeof children ] ) ;
498
494
499
495
// Track label overflow for auto tooltip (only when enabled)
500
496
const mergedLabelRef = useCombinedRefs ( ( labelProps as any ) ?. ref ) ;
@@ -519,7 +515,7 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
519
515
} , [ children , isAutoTooltipEnabled , checkLabelOverflow ] ) ;
520
516
521
517
useEffect ( ( ) => {
522
- if ( ! isAutoTooltipEnabled || typeof children !== 'string' ) return ;
518
+ if ( ! isAutoTooltipEnabled ) return ;
523
519
524
520
const label = mergedLabelRef . current ;
525
521
if ( ! label ) return ;
@@ -614,7 +610,7 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
614
610
return (
615
611
< TooltipProvider
616
612
placement = { defaultTooltipPlacement }
617
- title = { children }
613
+ title = { tooltipProps . title ?? children }
618
614
{ ...tooltipProps }
619
615
>
620
616
{ itemElement }
0 commit comments