Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
amend($mdGesture): allow buttons/forms to send clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Jan 27, 2015
1 parent dde9ab7 commit e190abe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/services/gesture/gesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercance
var HANDLERS;

document.addEventListener('click', function(ev) {
// Space/enter on a button, and submit events, can send clicks
var isKeyClick = ev.clientX === 0 && ev.clientY === 0 &&
ev.x === 0 && ev.y === 0;
// Prevent clicks unless they're sent by material
if (!ev.$material) {
if (!isKeyClick && !ev.$material) {
ev.preventDefault();
ev.stopPropagation();
}
Expand Down
1 change: 1 addition & 0 deletions src/core/services/gesture/gesture.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe('$mdGesture', function() {

beforeEach(module('material.core', function() {
angular.element(document).triggerHandler('$$mdGestureReset');
}));
Expand Down

0 comments on commit e190abe

Please sign in to comment.