From f828e5b80e21f297b5f521fcac4694acf800fbfc Mon Sep 17 00:00:00 2001 From: mertsincan Date: Mon, 25 Jan 2021 11:40:51 +0300 Subject: [PATCH] Fixed #1770 - If Tooltip's content is empty, the tooltip may not be rendered. --- src/components/tooltip/Tooltip.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/tooltip/Tooltip.js b/src/components/tooltip/Tooltip.js index 76789127a3..0255865985 100644 --- a/src/components/tooltip/Tooltip.js +++ b/src/components/tooltip/Tooltip.js @@ -129,6 +129,10 @@ export class Tooltip extends Component { show(e) { this.currentTarget = e.currentTarget; + if (this.isContentEmpty(this.currentTarget)) { + return; + } + const updateTooltipState = () => { this.updateText(this.currentTarget, () => { if (this.props.autoZIndex && !this.containerEl.style.zIndex) { @@ -333,6 +337,10 @@ export class Tooltip extends Component { } } + isContentEmpty(target) { + return !(this.props.content || (target && target.getAttribute('data-pr-tooltip')) || this.props.children); + } + componentDidMount() { if (this.props.target) { this.loadTargetEvents();