diff --git a/src/standard/gestures.html b/src/standard/gestures.html index 42ade2c014..c87401e7d3 100644 --- a/src/standard/gestures.html +++ b/src/standard/gestures.html @@ -124,8 +124,8 @@ var bcr = t.getBoundingClientRect(); // use page x/y to account for scrolling var x = ev.pageX, y = ev.pageY; - return (x >= bcr.left && x <= bcr.right) && - (y >= bcr.top && y <= bcr.bottom); + // ev is a synthetic click if the position is outside the bounding box of the target + return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom)); } return false; } diff --git a/test/unit/gestures.html b/test/unit/gestures.html index 0a10a8283f..e77a45e344 100644 --- a/test/unit/gestures.html +++ b/test/unit/gestures.html @@ -54,6 +54,8 @@ }); test('HTMLElement.click triggers tap', function() { + // put the element off screen to prevent x/y weirdness from .click() + app.style.cssText = 'position: absolute; left: -1000px; top: -1000px;'; // make a mousedown *very* far away to tickle the distance check var ev = new CustomEvent('mousedown'); ev.clientX = 1e8;