ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.94k stars 13.52k forks source link

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

Closed kuwabarahiroshi closed 9 years ago

kuwabarahiroshi commented 9 years ago

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 commented 9 years ago

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

kuwabarahiroshi commented 9 years ago

I confirmed that #2752 fixes this issue also.

mhartington commented 9 years ago

Will look at the PR tomorrow

halfpt commented 9 years ago

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.

mhartington commented 9 years ago

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

@halfpt please open a new issue for this.

kuwabarahiroshi commented 9 years ago

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

ritvick commented 9 years ago

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.

beekermememe commented 9 years ago

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

ritvick commented 9 years ago

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 ?
w3apps commented 9 years ago

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.

mhartington commented 9 years ago

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

fhofer commented 9 years ago

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!

plnkr2015 commented 8 years ago

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,