-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
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.