ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

[ion-side-menus] drag-content="false" only works on first tab.

Open kuwabarahiroshi opened this issue 11 years ago • 13 comments

I'm developing an app using ion-side-menus which has ion-tabs under ion-side-menu-content.

I want to disable drag-content functionality, so I set the attribute to false.

<ion-side-menu-content drag-content="false">

Yes it works, but only on the first tab if ion-side-menu-content has an ion-tabs inside it.

Here is a codepen: http://codepen.io/hiroshi-kuwabara/pen/MYeorv

How to reproduce:

  1. In a "Home" tab, drag content left or right, and side menu doesn't open (drag-content="false" is working).
  2. In "About" tab, or "Contact" tab, drag content left or right, then side menu opens.

kuwabarahiroshi avatar Dec 18 '14 10:12 kuwabarahiroshi

I'm afraid this issue may be relevant with issue #2751

kuwabarahiroshi avatar Dec 18 '14 11:12 kuwabarahiroshi

I confirmed that #2752 fixes this issue also.

kuwabarahiroshi avatar Dec 18 '14 11:12 kuwabarahiroshi

Will look at the PR tomorrow

mhartington avatar Jan 20 '15 04:01 mhartington

hi @mhartington, please let me know if you would like me to raise a separate issue for this, but wanted to give heads up as you mention you will be looking into this fix.

I applied the PR fix above, and now the content respects the 'drag-content="false"' attribute, however when arriving from a separate (non-tab) login state, the attribute edge-drag-threshold=.. on 'ion-side-menu-content' is ignored; you can drag from anywhere in the page.

Codepen forked from above demonstrates: http://codepen.io/halfpt/pen/LELbXa

Many thanks.

halfpt avatar Jan 23 '15 15:01 halfpt

@kuwabarahiroshi #2752 was merged, can you confirm your issue was resolved by testing the nightly builds?

@halfpt please open a new issue for this.

mhartington avatar Feb 09 '15 23:02 mhartington

@mhartington Thanks a lot! I confirmed that the issue is resolved with the nightly builds. I tested it on Chrome(Mac), iPhone, Android.

kuwabarahiroshi avatar Feb 10 '15 00:02 kuwabarahiroshi

I still face this issue, I have disabled caching completely so that my controllers are executed everytime. In my controller I have $ionicSideMenuDelegate.canDragContent(false);

It does work for the first time, but after switching few states and returning back to the state which invokes that particular controller, but $ionicSideMenuDelegate.canDragContent(false); doesn't stop it anymore.

ritvick avatar Mar 28 '15 16:03 ritvick

@ritvick : Have you tried - $scope.$on('$ionicView.afterEnter', function(){}), I have used this in the past?

beekermememe avatar Mar 28 '15 17:03 beekermememe

Yes thats what I was thinking, I have $ionicSideMenuDelegate.canDragContent(false); defined in my controller, but I think this is executed after the view is loaded and then it does not have any effect on that view. Though if I move to other view then it works as expected.

  1. Where I shall define $scope.$on('$ionicView.afterEnter', function(){}) ? Inside run function ?
  2. Do I need to specify $ionicSideMenuDelegate.canDragContent(false); inside above mentioned inline function ?

ritvick avatar Mar 28 '15 19:03 ritvick

The problem is still there in v1.0.0-rc.2-nightly-1177. Only the first tab works ok with edge-drag-threshold="true", the next tabs I click ignore edge-drag-threshold. If I go back to the first tab it still works ok. Tested on Android 5.0.2.

w3apps avatar Apr 02 '15 09:04 w3apps

Can you all please provide a codepen or demo and test it against the nightly builds?

mhartington avatar Apr 10 '15 19:04 mhartington

I know it's not exactly the same problem but some kind of similar one: I'm on an app based on the principle of another app which goes around here and does not show the tab bar before "Sign in" is clicked. Now the combination of this app and the side menu starter app brings back this problem (with edge-drag-threshold, drag-content seems fine though): As long as you are not on the tab page everything is fine but as soon as you open the view with the tab bar, it's possible again to swipe in the side menu (found out because it interferes with your image slider) when drag-content is not set to false.

Thanks for any feedback!

fhofer avatar May 20 '15 15:05 fhofer

hi,

while works great. but if i use it on the tab where map is there then map event listeners (like drag, dragstart, dragend etc) are not working.

i would like to design in such a way that on that tab when user drags the map i can listen to the map even listeners and at the same time disable the ionic side menu drag content.

how to achieve that?

please help. regards,

plnkr2015 avatar May 21 '16 21:05 plnkr2015