-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Race condition on toggleMenu in headers #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Shit, my bad. I pushed a little feature this morning that I shouldn't have. I disabled it until I can do it right. Also updated the most recent release. |
Actually, when it is open and you click the toggle, setPercentage tries to fire three times. Once from the actual toggleLeft(), once from the menu being clicked, and once from the gesture control: Lines 214 -217
The click is a gesture, and it seems to default to right, even when there is no movement. Then, the ratio is obviously 1, because the menu is open, so it tries to reopen the menu. If this fires after the toggleLeft(), it'll reopen the menu. So we have a case where there is the menu tap event trying to close it, the gesture event trying to open it, and the toggleLeft trying to close it, all racing. |
This seemed to have been fixed momentarily, but on the latest release the problem is still there. toggleLeft doesn't close the leftside when it is open. |
Hey, I just pushed a fix for this, I'd love to know if it's working for you now. Thanks! |
Seems to be working good now on my Nexus 5. |
If not mistaken this one might still be a bug as it's not related to the claim system but rather the menu implementation Sent from my iPhone
|
I believe this still is a bug. It results in some very odd behavior for me, as when I click the button it will occasionally open and then close the menu immediately or it will work as expected...Results are about 50/50. |
@flinn, I am looking at this right now and trying to narrow it down. Which device are you testing on? |
I've been testing this with an iPhone 4S -- When I use the iOS simulator or the Ripple Emulator I've never seen this behavior, only on the device. |
Okay, thanks. On my iPhone 5 I can't seem to reproduce it. If you had a test case for us to try that would really help. Thanks! Edit: also make sure you are using a new version of Ionic. |
My code is a very close replication of this codepen, http://codepen.io/ionic/pen/vqhzt ... The only changes that I have are to the styling of the button... I am just using a span styled with a background/logo image instead of an < i > element. |
I'm trying to use this codepen http://codepen.io/ionic/pen/vqhzt with a newer version of Ionic but still couldn't. |
@vanderleisp take a look at our codepens which are all updated |
There's a bug easily observed in this demo here:
http://ionicframework.com/examples/side-menu/#
When you click the Toggle on the top left, the menu opens as normal. However, when you click it again, it doesn't close. I investigated and found two competing functions that race:
It's from line 55-62 here:
https://github.com/driftyco/ionic/blob/master/js/controllers/sideMenuController.js
And line 67-69 here:
https://github.com/driftyco/ionic/blob/master/js/ext/angular/src/directive/ionicSideMenu.js
Essentially, when clicking close on the menu, it might either:
#1) First fire the menu tap close event, setting percentage to 0, and then fire the toggleLeft setting it back to 100, which results in no change which is wrong.
#2) Fire it in reverse order, which results in expected behavior.
The simple solution would be to create a lock which prevents the setPercentage function from running more than once every 100ms. Let me know if anyone has any better solutions.
The text was updated successfully, but these errors were encountered: