[Beta 14] Issues with dragging to show/hide the side menu on Android
I created a Codepen where the issue can be reproduced. Link: http://codepen.io/anon/pen/EaPjJR . It is based on the official Side Menu and Navigation Codepen (http://codepen.io/ionic/pen/tcIGK).
The only difference between the two is that I added a handle on the left side of the screen with a toggle menu directive.
On Android, If I start the side menu drag on the navigation bar or the handle, nothing happens. On desktop Chrome and on iOS this works just fine.
Also, when the side menu is open, it is not possible to use a drag to close it again. Only a click on the content area or the navicon closes it.
The problem occurs on Android 4.4.4 and 4.2.2 and possible more versions.
Forgot to mention this is using the following version: v1.0.0-beta.13-nightly-852
I got the same issue with the same version. Another thing I mentioned is, that there is no animation anymore when toggling the sidemenu. But also just on android.
What devices are you using @casperbruun, @bwasnie1?
I've confirmed this is a problem on Android 4.4.2 using a Moto G.
@casperbruun - you're using the codepen above when you say you're not getting any animations? Can you provide any more info? Also, if you feel it's a bug it'd be better to open a new ticket to keep this things organized.
I am using Galaxy Note 4 with Android 4.4.4.
I tested on a Nexus 5 running 4.4.4 and a Galaxy S4 with version 4.2.2.
@drewrygh I am getting animations. I think your comment was meant for @bwasnie1 :)
I want to add, that I am not using the ionic.bundle.js as in @cbruun codepen examples. My index.html includes these files (also same order) angular.js#1.3.5 angular-animate.js#1.3.5 ionic.js#1.0.0-beta.13-nightly-854 ionic-angular.js#1.0.0-beta.13-nightly-854
I used Ionic v1.0.0-beta.13 "lanthanum-leopard" before where the dragging works fine, but not the scrolling in the "ion-side-menu-content" directive.
@bwasnie1 Would you be able to create a codepen replicating the issue? thanks
Haven't created one yet, sry ^^ I was looking in ionic-angular.js to find the issue and I have found that the onDragRelease(e) function is already called while I am still dragging with my finger. Then I did the same in my browser, but there the onDragRelease(e) function works perfectly and only gets called when i release mousebutton while/after dragging.
A quick but dirty workaround is to change the onDragX(e) function:
function onDragX(e) {
if (!sideMenuCtrl.isDraggableTarget(e)) return;
if (getPrimaryScrollAxis(e) == 'x') {
sideMenuCtrl._handleDrag(e);
}
e.gesture.srcEvent.preventDefault();
}
This worked for me, but I think there are better ways to fix this ^^
@bwasnie1 ionic.bundle.js is a concatenation of:
ionic.js,
angular.js,
angular-animate.js,
angular-sanitize.js,
angular-ui-router.js,
ionic-angular.js
If you use the nightly ionic bundle is the animation problem fixed? I've tried on 3+ emulated Android devices so maybe you don't have the right file/order?
@cbruun - I was initially thinking you were trying to trigger the sidemenu to open by sliding the handle. Tapping on Android 4.2.2, 4.4.4 works on all devices I've tried on, and I've built directly from your codepen. Maybe you can provide a video? Need something more to be able to confirm/reproduce this.
@drewrygh
I am trying to open the side menu with a sliding gesture that starts on the handle or the navigation bar. Neither works.
If I start the drag gesture in the middle of the page the side menu is shown. A tap on the handle will show the side menu as well.
Once the side menu is open only a tap can close it again. A dragging motion will not work.
@drewrygh Thanks for your help, but it wasn't the file order ^^ I am a little bit embarrassed because the solution was that simple. I had "overflow-scroll='true'" on my ion-content. After removing it, it works with dragging it open. Not as smooth as on pc but it works.
As @cbruun said: "Once the side menu is open only a tap can close it again. A dragging motion will not work." I have the same problem with that now.
@drewrygh Made a video: https://drive.google.com/file/d/0B7tG5TmrpqCSYm03ZjFSWE1kems/view
I'm using the codepen and I cannot get it to not work. When you use the same codepen it doesn't work either on any Android device?
@adamdbradley @drewrygh I can see the Codepen works now when run from a Chrome browser on Android. I am almost certain it did not work when I submitted the bug report, but it could be an error on my part.
However, it does not work when run from within Cordova app. I tried using both Cordova 3.6.3 and 4.1 and the problem persists on both versions. Both Android test phones have the exact same problem.
The Cordova app is completely bare-bone. I ran the create project command and added the files from the Codepen along with a small config.xml file. No plugins or custom native code.
@adamdbradley @drewrygh
After a lot of debugging I can see the issue is related to #1729. I have created a directive with a temporary fix, see below. It works with both Android test phones (4.4.4 and 4.2.2).
Do you know if using this workaround will have any negative consequences? So far the app seems to be running just fine.
angular
.module('ionictestmodule')
.directive('fixAndroidTouch', [
'$rootScope', '$ionicPlatform',
function(rootScope, ionicPlatform) {
return {
link: function() {
ionicPlatform.ready().then(function() {
if (ionic.Platform.isAndroid()) {
var documentOnTouchMoveFix = function (event) {
event.preventDefault();
};
document.ontouchmove = documentOnTouchMoveFix;
rootScope.$on('$ionicView.afterEnter', function () {
document.ontouchmove = documentOnTouchMoveFix;
});
}
});
}
};
}
]);
no fix yet? updated from beta 13 to beta 14 and now can't close side menu by swiping...
LG G3 4.4.2 1.0.0-beta.14-nightly-924
:(
Still facing this issue :|