Skip to content

Commit

Permalink
ELEMENTS-1580: fix tool tip not disappearing
Browse files Browse the repository at this point in the history
  • Loading branch information
satishyadav-dev committed Feb 28, 2023
1 parent c1d16c7 commit 8eea86a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions widgets/nuxeo-tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
// reference is used in addEventListener and removeEventListener (and prevent potential memory leaks)
this._showListener = this.show.bind(this);
this._hideListener = this.hide.bind(this);
this._keyListener = this.keydown.bind(this);
}

connectedCallback() {
Expand All @@ -93,6 +94,7 @@
this._target.addEventListener('mouseleave', this._hideListener);
this._target.addEventListener('blur', this._hideListener);
this._target.addEventListener('tap', this._hideListener);
window.addEventListener('keydown', this._keyListener);
}
}

Expand All @@ -104,6 +106,7 @@
this._target.removeEventListener('mouseleave', this._hideListener);
this._target.removeEventListener('blur', this._hideListener);
this._target.removeEventListener('tap', this._hideListener);
window.addEventListener('keydown', this._keyListener);
}
this._target = null;
}
Expand Down Expand Up @@ -132,10 +135,15 @@
}

hide() {
if (this._tooltip) {
document.body.removeChild(this._tooltip);
this._tooltip = null;
const paperToolTip = document.getElementsByTagName("paper-tooltip");
if (paperToolTip[0]) {
document.body.removeChild(paperToolTip[0]);
}
this._tooltip = null;
}

keydown() {
this.hide();
}

/**
Expand Down

0 comments on commit 8eea86a

Please sign in to comment.