Skip to content

Commit

Permalink
Possible fix for #1398
Browse files Browse the repository at this point in the history
  • Loading branch information
karanjthakkar authored and Garbee committed May 24, 2016
1 parent 2ba2dd9 commit 5065fe8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@
};

/**
* Handle mouseleave for tooltip.
* Hide tooltip on mouseleave or scroll
*
* @private
*/
MaterialTooltip.prototype.handleMouseLeave_ = function() {
MaterialTooltip.prototype.hideTooltip_ = function() {
this.element_.classList.remove(this.CssClasses_.IS_ACTIVE);
};

Expand All @@ -133,11 +133,12 @@
}

this.boundMouseEnterHandler = this.handleMouseEnter_.bind(this);
this.boundMouseLeaveHandler = this.handleMouseLeave_.bind(this);
this.boundMouseLeaveAndScrollHandler = this.hideTooltip_.bind(this);
this.forElement_.addEventListener('mouseenter', this.boundMouseEnterHandler, false);
this.forElement_.addEventListener('touchend', this.boundMouseEnterHandler, false);
this.forElement_.addEventListener('mouseleave', this.boundMouseLeaveHandler, false);
window.addEventListener('touchstart', this.boundMouseLeaveHandler);
this.forElement_.addEventListener('mouseleave', this.boundMouseLeaveAndScrollHandler, false);
window.addEventListener('scroll', this.boundMouseLeaveAndScrollHandler, true);
window.addEventListener('touchstart', this.boundMouseLeaveAndScrollHandler);
}
}
};
Expand Down

0 comments on commit 5065fe8

Please sign in to comment.