Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ignoring hammer js events on input elements, even if witing a touch-e…
…nabled element
  • Loading branch information
gatapia committed Jun 13, 2014
1 parent aa1aac6 commit 12dd3ca
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/pn/ui/GlobalGestureHandler.js
Expand Up @@ -42,15 +42,17 @@ pn.ui.GlobalGestureHandler = function(parent) {
e.gesture.stopPropagation();
e.gesture.stopDetect();
};
var isforinp = function(el) {
if (el instanceof HTMLInputElement) return true;
if (!(el instanceof HTMLLabelElement)) return false;
var id = el.getAttribute('for');
var forel = id ? pn.dom.get(id) : null;
return forel instanceof HTMLInputElement;
};
var fire = function(type, e) {
var el = this.getTouchEl_(e.target);
if (!el) return;
// Calling kill was stopping the checkboxes on lists working on Adnroid.
// But this was originally put in for a reason, I think issues with IOs
// so we may need to revisit this commenting out. Perhaps only call
// if IOs if checkboxes work. Leaving commented out code just in case
// as this may bite even with Android in some cases.
// kill(e);
if (!el || isforinp(e.target)) { return; }
kill(e);
var ev = new goog.events.Event(type, el);
ev.actualtarget = e.target;
this.dispatchEvent(ev);
Expand All @@ -65,7 +67,7 @@ pn.ui.GlobalGestureHandler = function(parent) {
if (e.gesture.direction == 'left') { type = EventType.SWIPELEFT; }
else if (e.gesture.direction == 'right') { type = EventType.SWIPERIGHT; }
if (!el || !type) return;
// kill(e);
kill(e);

this.dispatchEvent(new goog.events.Event(type, el));
}, this));
Expand Down

0 comments on commit 12dd3ca

Please sign in to comment.