diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 37487927..3e70182e 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -56,6 +56,7 @@ const Tooltip = ({ position, afterShow, afterHide, + disableTooltip, // props handled by controller content, contentWrapperRef, @@ -459,6 +460,9 @@ const Tooltip = ({ const elementRefs = new Set(anchorRefs) anchorsBySelect.forEach((anchor) => { + if(disableTooltip?.(anchor)){ + return; + } elementRefs.add({ current: anchor }) }) diff --git a/src/components/Tooltip/TooltipTypes.d.ts b/src/components/Tooltip/TooltipTypes.d.ts index 6289d799..ee7fc42c 100644 --- a/src/components/Tooltip/TooltipTypes.d.ts +++ b/src/components/Tooltip/TooltipTypes.d.ts @@ -152,6 +152,7 @@ export interface ITooltip { setIsOpen?: (value: boolean) => void afterShow?: () => void afterHide?: () => void + disableTooltip?: (anchorRef: HTMLElement | null) => boolean activeAnchor: HTMLElement | null setActiveAnchor: (anchor: HTMLElement | null) => void border?: CSSProperties['border'] diff --git a/src/components/TooltipController/TooltipController.tsx b/src/components/TooltipController/TooltipController.tsx index f5d06e5a..289f1d1d 100644 --- a/src/components/TooltipController/TooltipController.tsx +++ b/src/components/TooltipController/TooltipController.tsx @@ -61,6 +61,7 @@ const TooltipController = React.forwardRef( setIsOpen, afterShow, afterHide, + disableTooltip, role = 'tooltip', }: ITooltipController, ref, @@ -370,6 +371,7 @@ const TooltipController = React.forwardRef( setIsOpen, afterShow, afterHide, + disableTooltip, activeAnchor, setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor), role, diff --git a/src/components/TooltipController/TooltipControllerTypes.d.ts b/src/components/TooltipController/TooltipControllerTypes.d.ts index a6a5e289..a201ba1d 100644 --- a/src/components/TooltipController/TooltipControllerTypes.d.ts +++ b/src/components/TooltipController/TooltipControllerTypes.d.ts @@ -94,6 +94,7 @@ export interface ITooltipController { setIsOpen?: (value: boolean) => void afterShow?: () => void afterHide?: () => void + disableTooltip?: (anchorRef: HTMLElement | null) => boolean role?: React.AriaRole }