@@ -125,6 +125,10 @@ export interface CubeItemBaseProps extends BaseProps, ContainerStyleProps {
125125 * @default "top"
126126 */
127127 defaultTooltipPlacement ?: OverlayProps [ 'placement' ] ;
128+ /**
129+ * Ref to access the label element directly
130+ */
131+ labelRef ?: RefObject < HTMLElement > ;
128132}
129133
130134const DEFAULT_ICON_STYLES : Styles = {
@@ -359,10 +363,12 @@ export function useAutoTooltip({
359363 tooltip,
360364 children,
361365 labelProps,
366+ labelRef : externalLabelRef ,
362367} : {
363368 tooltip : CubeItemBaseProps [ 'tooltip' ] ;
364369 children : ReactNode ;
365370 labelProps ?: Props ;
371+ labelRef ?: RefObject < HTMLElement > ;
366372} ) {
367373 // Determine if auto tooltip is enabled
368374 // Auto tooltip only works when children is a string (overflow detection needs text)
@@ -574,6 +580,7 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
574580 suffix ??
575581 ( hotkeys ? (
576582 < HotKeys
583+ { ...( keyboardShortcutProps as any ) }
577584 type = { type === 'primary' ? 'primary' : 'default' }
578585 styles = { { padding : '1x left' , opacity : finalIsDisabled ? 0.5 : 1 } }
579586 >
@@ -633,7 +640,7 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
633640
634641 const {
635642 labelProps : finalLabelProps ,
636- hasTooltip ,
643+ labelRef ,
637644 renderWithTooltip,
638645 } = useAutoTooltip ( { tooltip, children, labelProps } ) ;
639646
@@ -660,7 +667,6 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
660667 return (
661668 < ItemBaseElement
662669 ref = { handleRef }
663- tabIndex = { 0 }
664670 variant = {
665671 theme && type ? ( `${ theme } .${ type } ` as ItemVariant ) : undefined
666672 }
@@ -682,7 +688,7 @@ const ItemBase = <T extends HTMLElement = HTMLDivElement>(
682688 ) }
683689 { finalPrefix && < div data-element = "Prefix" > { finalPrefix } </ div > }
684690 { children || labelProps ? (
685- < div data-element = "Label" { ...finalLabelProps } >
691+ < div ref = { labelRef } data-element = "Label" { ...finalLabelProps } >
686692 { children }
687693 </ div >
688694 ) : null }
0 commit comments