@@ -125,8 +125,8 @@ export class MenuController {
125125 * @return {Promise } returns a promise when the menu is fully opened
126126 */
127127 open ( menuId ?: string ) : Promise < boolean > {
128- let menu = this . get ( menuId ) ;
129- if ( menu ) {
128+ const menu = this . get ( menuId ) ;
129+ if ( menu && ! this . isAnimating ( ) ) {
130130 let openedMenu = this . getOpen ( ) ;
131131 if ( openedMenu && menu !== openedMenu ) {
132132 openedMenu . setOpen ( false , false ) ;
@@ -171,9 +171,9 @@ export class MenuController {
171171 * @return {Promise } returns a promise when the menu has been toggled
172172 */
173173 toggle ( menuId ?: string ) : Promise < boolean > {
174- let menu = this . get ( menuId ) ;
175- if ( menu ) {
176- let openedMenu = this . getOpen ( ) ;
174+ const menu = this . get ( menuId ) ;
175+ if ( menu && ! this . isAnimating ( ) ) {
176+ var openedMenu = this . getOpen ( ) ;
177177 if ( openedMenu && menu !== openedMenu ) {
178178 openedMenu . setOpen ( false , false ) ;
179179 }
@@ -191,7 +191,7 @@ export class MenuController {
191191 * @return {Menu } Returns the instance of the menu, which is useful for chaining.
192192 */
193193 enable ( shouldEnable : boolean , menuId ?: string ) : Menu {
194- let menu = this . get ( menuId ) ;
194+ const menu = this . get ( menuId ) ;
195195 if ( menu ) {
196196 return menu . enable ( shouldEnable ) ;
197197 }
@@ -204,7 +204,7 @@ export class MenuController {
204204 * @return {Menu } Returns the instance of the menu, which is useful for chaining.
205205 */
206206 swipeEnable ( shouldEnable : boolean , menuId ?: string ) : Menu {
207- let menu = this . get ( menuId ) ;
207+ const menu = this . get ( menuId ) ;
208208 if ( menu ) {
209209 return menu . swipeEnable ( shouldEnable ) ;
210210 }
@@ -229,7 +229,7 @@ export class MenuController {
229229 * @return {boolean } Returns true if the menu is currently enabled, otherwise false.
230230 */
231231 isEnabled ( menuId ?: string ) : boolean {
232- let menu = this . get ( menuId ) ;
232+ const menu = this . get ( menuId ) ;
233233 return menu && menu . enabled || false ;
234234 }
235235
@@ -278,14 +278,21 @@ export class MenuController {
278278 return this . _menus . find ( m => m . isOpen ) ;
279279 }
280280
281-
282281 /**
283282 * @return {Array<Menu> } Returns an array of all menu instances.
284283 */
285284 getMenus ( ) : Array < Menu > {
286285 return this . _menus ;
287286 }
288287
288+ /**
289+ * @private
290+ * @return {boolean } if any menu is currently animating
291+ */
292+ isAnimating ( ) : boolean {
293+ return this . _menus . some ( menu => menu . isAnimating ( ) ) ;
294+ }
295+
289296 /**
290297 * @private
291298 */
0 commit comments