I currently have a <md-menu>
element implemented in my webpage. By default, the menu will close if clicked anywhere on the page. However, I have noticed that when clicking inside a fixed
element with a specified z-index
, the menu does not close.
<div class="menu-demo-container" layout-align="center center" layout="column">
<md-menu>
<md-button class="md-primary md-raised" ng-click="ctrl.openMenu($mdOpenMenu, $event)">
Test
</md-button>
<md-menu-content width="4">
<md-menu-item>
<md-button>
Menu Item
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
<div style="position:fixed; z-index: 100; backgorund-color:red;left:0;top:0;bottom:0">
Please try clicking here while the md-menu is open
</div>
I am looking for a solution to make all my <md-menu>
elements close when clicked anywhere outside of the menu, even if it's on fixed elements.