Material: mdMenu: When one mdMenu is destroyed, other open mdMenus hide

Created on 11 Feb 2016  路  3Comments  路  Source: angular/material

Demo here: http://codepen.io/anon/pen/jWXJbb

You can see the issue by opening the first menu (Phone) and clicking on "Option 2", which will hide the second menu button (Envelope). When Envelope is hidden, the menu for Phone is hidden as well, even though md-prevent-menu-close is on the menu button. If you click Option 2 again on Phone it will show Envelope again and not close Phone's menu (correct behavior).

I think this is due to the commit for #6545, which adds this:

menuContainer.on('$destroy', function() {
      $mdMenu.destroy();
});

It doesn't check if the $mdMenu that's being destroyed is actually associated with the destroyed menu container.

Locally I have done this, which seems to work but not sure if it's a good fix:

menuContainer.on('$destroy', function () {
      if(self.isOpen) $mdMenu.destroy();
});

Thank you!

urgent

All 3 comments

@rschmukler do you mind taking a look at this suggested fix? Thanks

I don't know, but I think self.isOpen is not an elegant solution, because it's not binded in way to the actual interimElement stack.

This issue is closed as part of our 鈥楽urge Focus on Material 2' efforts.
For details, see our forum posting @ http://bit.ly/1UhZyWs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bobber205 picture bobber205  路  3Comments

vladimir-barsuchenko picture vladimir-barsuchenko  路  3Comments

ghost picture ghost  路  3Comments

buzybee83 picture buzybee83  路  3Comments

ddimitrop picture ddimitrop  路  3Comments