Skip to content

bug: tapIgnoreEvent doesn't check for data-tap-disabled #2132

Closed

Description

@emertechie

Type: bug

Platform: mobile webview

For various reasons I had to use another scrolling library in one area of my app. To disable the Ionic scroll stuff, I used overflow-scroll="true" on the ion-content and also data-tap-disabled="true" on a container element. However the Ionic tap library was still interfering (causing events not to fire in the other library).

It boiled down to the tapIgnoreEvent method in tap.js:

function tapIgnoreEvent(e) {
  if(e.isTapHandled) return true;
  e.isTapHandled = true;

  if( ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) {
    e.preventDefault();
    return true;
  }
}

It's not checking if the element, or a parent, has the "data-tap-disabled" attribute set.
It should be using the isElementTapDisabled method like other tap handlers. Changing first line to the following fixes issues:

function tapIgnoreEvent(e) {
  if(e.isTapHandled || ionic.tap.isElementTapDisabled(e.target)) return true;
  ...

Activity

  1. adamdbradley commented on Sep 8, 2014

    @adamdbradley
    Contributor

    Would you be able to provide a simple codepen replicating the issue. I want to make sure I can break and fix with the same html structure you're using. Thanks

  2. added
    needs: reply
    on Sep 8, 2014
  3. emertechie commented on Sep 10, 2014

    @emertechie
    Author

    Thanks for taking a look Adam. Ok, sure, I'll try get something together. I'm travelling at the moment though so will be towards end of this week before I can update.

  4. emertechie commented on Sep 11, 2014

    @emertechie
    Author

    @adamdbradley Ok got a repro for you here: http://codepen.io/emertechie/pen/sopig/

    As you'll see I'm using the iScroll library. To repro, focus into one of the text fields and try to scroll up or down. You won't be able to. If you swap the script out to point to my custom version on dropbox which has the change proposed above, it works.

  5. removed
    needs: reply
    on Jan 19, 2015
  6. Ionitron commented on Mar 11, 2015

    @Ionitron
    Collaborator

    We do not recommend using two scroll libraries in the same app.

  7. anemitoff commented on Apr 9, 2015

    @anemitoff

    I don't understand why the proposed "fix" was rejected. The documentation states that the "data-tap-disabled" can be used to bypass tap handling for designated elements and that isn't 100% true.

    I too have a non-supported use-case (IE Browser for Desktop with HTML5 Video Element whose control clicks are being intercepted by the tap handler), but I don't see why I shouldn't be able to use "data-tap-disabled" sucessfuly.

  8. mlynch commented on Dec 6, 2015

    @mlynch
    Contributor

    Fixed in 3119679

  9. locked and limited conversation to collaborators on Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions