From 5ffff583a305adfdaab07287fc4c1541a14eff51 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Fri, 21 Feb 2014 11:14:15 -0800 Subject: [PATCH] Only fire tap for mouse if it came from a left click Fixes #25 --- src/tap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tap.js b/src/tap.js index e7d3dc1..2476b10 100644 --- a/src/tap.js +++ b/src/tap.js @@ -63,9 +63,15 @@ } } }, + shouldTap: function(e) { + if (!e.tapPrevented) { + // only allow left click to tap for mouse + return e.pointerType === 'mouse' ? e.buttons === 1 : true; + } + }, pointerup: function(inEvent) { var start = pointermap.get(inEvent.pointerId); - if (start && !inEvent.tapPrevented) { + if (start && this.shouldTap(inEvent)) { var t = scope.findLCA(start.target, inEvent.target); if (t) { var e = dispatcher.makeEvent('tap', {