Skip to content

Commit

Permalink
Fixed #1770 - If Tooltip's content is empty, the tooltip may not be r…
Browse files Browse the repository at this point in the history
…endered.
  • Loading branch information
mertsincan committed Jan 25, 2021
1 parent 7e64618 commit f828e5b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f828e5b

Please sign in to comment.