Why is Android responding to wrong touch events?


It appears that the event my ng-click directive manages is tied to the touchstart event and not the expected touchend event. I’m seeing this behavior on Android (v4.2.2)

Example: wherever I touch the screen in region A, if I drag my finger around the screen and release it in region B, the ng-click event occurs in region A.

This is the template I’m using to bind click events to an image gallery:

  <ion-content has-bouncing="false">
    <div class="item" ng-repeat="rows in data">
            <img ng-src="img/thumbs/{{item.path}}" class="thumbnail" ng-click="openDetailPage(item)"/>
            <div class="img-sub-heading">{{item.title}}</div>

Has anyone behaviour like this before? Is this a bug in ionic, or is there anything I can do to correct this on my end?


What version of Ionic are you using? If using the Beta 1, can you try the nightly? Also posting a CodePen sample will make it easier for anyone to help you.


I’m using v1.0.0-beta.1.

I’ve created this CodePen to help reproduce the issue. http://codepen.io/anon/pen/glKDn

If when loading this URL and following these steps (on an Android 4.2.2 device), you can reproduce the above-mentioned behavior, then I think there is an issue to report:

  1. Hold finger on ‘Alpha’
  2. Drag finger down to ‘Beta’ and release
  3. Preview page opens and says “Image: Alpha”

Edit: for these steps, I expect the ‘Beta’ page to be opened because that is where I released the touch event


Sorry for the delay in getting back to you I finally got my Android testing device setup. It’s a Samsung Galaxy Nexus i-515 running Android 4.2.2

Using your sample, I created an ionic project and installed on phone. With Beta 1, I don’t experience the same problem as you. “Alpha” does not open when I click on “Alpha” and drag down to Beta and release.

I’m not sure why this would be happening for you. Can you try to use the nightly and test this same process?

expect the ‘Beta’ page to be opened because that is where I released the touch event

I do not believe that should be the expected behavior at all. By touching Alpha and dragging to Beta, you have attempted to scroll. Scroll termination does not mean open wherever I stopped scrolling.


thank you again for taking the time to try and reproduce my test.

After MUCH effort, I’ve been able to discover the source of my problem. I was trying to use a third party cordova extension that was blowing up at runtime and interfering with the ‘Cordova’ object and as a result, the DeviceReady event was not firing. For some reason, this was causing the UI in my application to behave the way I have described above. When I removed the plugin, the touch events in my app started behaving as expected.

I would harbor a guess that ionic depends on DeviceReady in how it binds touch events to page elements.

I hope others can learn from this: If any devs are seeing weird touch event behavior - check to make sure that the deviceready event has fired.