diff --git a/modules/util/tooltip.js b/modules/util/tooltip.js index bdb15b3a7..969cedec8 100644 --- a/modules/util/tooltip.js +++ b/modules/util/tooltip.js @@ -89,6 +89,7 @@ export function tooltip(klass) { selection.call(tooltip.destroy, '.tooltip'); }; + var isTouchEvent = false; function setup() { var root = d3_select(this); @@ -118,12 +119,20 @@ export function tooltip(klass) { var place = _placement.apply(this, arguments); tip.classed(place, true); + root.on('touchstart.tooltip', function() { + // hack to avoid showing tooltips upon touch input + isTouchEvent = true; + }); root.on('mouseenter.tooltip', show); root.on('mouseleave.tooltip', hide); } function show() { + if (isTouchEvent) { + isTouchEvent = false; + return; + } var root = d3_select(this); var content = _title.apply(this, arguments); var tip = root.selectAll('.tooltip-' + _id);