Turn off ionic gesture recognizers for element

I am trying to embed a vis.js canvas in ionic. vis.js uses hammer.js for gesture detection, which I believe is the same as ionic. So I was getting multiple gesture events being fired, one from ionic, and one from vis.js.

Is there a way to turn off ionic gesture recognizers for an element in ionic?

I added the following code. It’s similar in spirit to the data-tap-disabled functionality. To ionic.tap:

 isElementGestureDisabled: function(ele) {
    if(ele && ele.nodeType === 1) {
      var element = ele;
      while(element) {
        if( (element.dataset ? element.dataset.gestureDisabled : element.getAttribute('data-gesture-disabled')) == 'true' ) {
          return true;
        element = element.parentElement;
    return false;

Then in ionic.Gestures.Instance.trigger (at the bottom):

if (!ionic.tap.isElementGestureDisabled(element))

I’m not sure if this covers all the cases, but it works for my use case.

You can also use data-tap-disable="true" which should disable our gesture system

1 Like

I tried that, but it was not disabling the drag events. ionic and vis.js were both sending the same drag events, which was causing the drag to fail. FYI, I have scroll=“false” on the content, and data-tap-disabled=“true” (and now data-gesture-disabled=“true”) on the div inside the content.

Ahh, alright that makes sense now. Hmm, we should probably make data-tap-disable cancel all events…

1 Like

Is there a way to see all the gesture events attached to an element? I can’t remove gestures without knowing the callback function that they are invoking.