Skip to content

Commit 51f8596

Browse files
committed
Resolve console errors from Tooltip component
1 parent 3135cf9 commit 51f8596

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/private/OverlayTemplates.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,27 @@ const TooltipTemplate = React.forwardRef(
7272
style,
7373
children,
7474
arrowProps,
75-
popper: _,
76-
show: _2,
75+
popper,
76+
show,
77+
hasDoneInitialMeasure,
7778
...props
7879
},
7980
ref
8081
) => {
8182
const [primaryPlacement] = placement?.split('-') || [];
8283
const bsDirection = getOverlayDirection(primaryPlacement);
8384

85+
const computedStyle = style;
86+
if (show && !hasDoneInitialMeasure)
87+
computedStyle = {
88+
...style,
89+
position: popper?.strategy,
90+
top: '0',
91+
left: '0',
92+
opacity: '0',
93+
pointerEvents: 'none'
94+
};
95+
8496
const {
8597
handleMouseOverTooltipContent,
8698
handleMouseLeaveTooltipContent
@@ -89,7 +101,7 @@ const TooltipTemplate = React.forwardRef(
89101
return (
90102
<div
91103
ref={ref}
92-
style={style}
104+
style={computedStyle}
93105
role="tooltip"
94106
x-placement={primaryPlacement}
95107
className={classNames(

0 commit comments

Comments
 (0)