From 21bfc53e6c67eb1a700c90435eeb62ca2f206208 Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Thu, 9 Jun 2016 16:18:53 -0400 Subject: [PATCH] Fix bug where an empty title would cause a sticky tooltip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + A tooltip should not show if the title attribute is present but empty. + It should always hide the tooltip, even IF it’s empty. Change-Id: I4e4ba6596da3f5dbf871077b66459cfdc624e26d --- .../behaviors/gr-tooltip-behavior/gr-tooltip-behavior.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior.js b/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior.js index 2da68469b8..dc0854a526 100644 --- a/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior.js +++ b/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior.js @@ -40,7 +40,11 @@ }, _handleShowTooltip: function(e) { - if (!this.hasAttribute('title') || this._tooltip) { return; } + if (!this.hasAttribute('title') || + this.getAttribute('title') === '' || + this._tooltip) { + return; + } // Store the title attribute text then set it to an empty string to // prevent it from showing natively. @@ -62,7 +66,7 @@ _handleHideTooltip: function(e) { if (!this.hasAttribute('title') || - !this._titleText || + this._titleText == null || this === document.activeElement) { return; } this.setAttribute('title', this._titleText);