material icon indicating copy to clipboard operation
material copied to clipboard

md-menu on md-toolbar: md-buttons are unclickable and text colors become white

Open roelbarreto opened this issue 10 years ago • 35 comments

The md-menu suddenly not working properly when attached to md-toolbar

 <md-toolbar layout="row">
   <div class="md-toolbar-tools">
     <h3>
       Title
     </h3>
     <md-menu md-position-mode="target-right target">
       <md-button aria-label="Open menu" class="md-icon-button" ng-click="$mdOpenMenu($event)">
         <ng-md-icon icon="more_vert"></ng-md-icon>
       </md-button>
       <md-menu-content width="4">
         <md-menu-item>
           <md-button ng-click="vm.logout()">
             Logout
           </md-button>
           <md-button ng-click="vm.settings()">
             Settings
           </md-button>
         </md-menu-item>
       </md-menu-content>
     </md-menu>
   </div>
</md-toolbar>

rc6 bug on menu

roelbarreto avatar Dec 03 '15 06:12 roelbarreto

+1

md-menu is now under the md-backdrop.

In fact the md-menu-content is not moved to the body level anymore.

PapyElGringo avatar Dec 03 '15 09:12 PapyElGringo

+1 also for me : md-menu is now under the md-backdrop.

m33ch avatar Dec 03 '15 09:12 m33ch

+1 same issue since 1.0.0-rc6 in Fire Fox

Tyrannmisu avatar Dec 03 '15 09:12 Tyrannmisu

Bug introduced in 1.0.0-rc6. Reproduced in Chrome.

elyas-bhy avatar Dec 03 '15 10:12 elyas-bhy

I can't find a simple hack to make it work..

I have a product who need an update and I already changed all my layout to work with rc6..

PapyElGringo avatar Dec 03 '15 11:12 PapyElGringo

+1

icchio avatar Dec 03 '15 12:12 icchio

+1

mustafahlvc avatar Dec 03 '15 12:12 mustafahlvc

+1

ttyrueiwoqp avatar Dec 03 '15 12:12 ttyrueiwoqp

its not the toolbar itself though, https://material.angularjs.org/latest/demo/menuBar still works and uses a toolbar.

generally though global assumptions on the stacking context of the entire app made by a single component is always difficult. e.g when the toolbar/menu is contained in its own stacking context somewhere up the chain the z-index properties of the menu/content divs will not behave as expected with respect to the main md-backdrop. not sure this kind of approach will ever be save. for dialogs its easier since the element is by definition on top of the container the backdrop is also in, where in the menu case the popup menus are but the menu bar itself is not.

matthiasg avatar Dec 03 '15 12:12 matthiasg

in the example they added style="position: relative; z-index: 100;" directly to the toolbar to 'fix' this issue.

i added a style="z-index:inherit" to my toolbar (i did not want the entire toolbar to be exempted) and set

md-menu-bar {
  z-index: 100;  
}

matthiasg avatar Dec 03 '15 13:12 matthiasg

If I put my md-menu inside a md-menu-bar it's work but the design is not the same

PapyElGringo avatar Dec 03 '15 13:12 PapyElGringo

Can confirm this is an issue.

I've had to revert to 2a1de83bcd2aa41e969e54c0292a4819a44a3c5b.

Edit: It looks like md-menu-bar expects to be inside md-toolbar to work properly, which is why the demo still works correctly.

bwegrzyn avatar Dec 03 '15 15:12 bwegrzyn

The first issue was just a md-menu inside a md-toolbar not a md-menu-bar.

PapyElGringo avatar Dec 03 '15 16:12 PapyElGringo

This isn't just a toolbar issue though, I think it's related to the md-menu and its backdrop. Here I prepared a codepen to illustrate the issue: http://codepen.io/srcn/pen/gPYyyg

Basically, it boils down what @matthiasg mentioned. If you have a z-index on one of the containers that holds the md-menu, you are going to have some trouble.

If you have a bigger z-index value than md-backdrop, the md-scroll-mask will stay on top of the md-backdrop preventing its being clicked. If you have a smaller z-index value, then md-backdrop basically will cover everything and it will prevent the menu being clicked.

srcn avatar Dec 03 '15 16:12 srcn

It's not only that. The md-menu-container used to be moved to the body level. Now it's still at the same place and depend on the toolbar css. So if you have some buttons inside the md-menu and your toolbar is primary (blue by default) the buttons will be unreadable because the font color will be white on white background.

Beside that the md-menu depend now of the container z-index for the display so if you have another toolbar or any item with the same z-index as the toolbar next after in the DOM the md-menu will me hidden behind it.

PapyElGringo avatar Dec 03 '15 17:12 PapyElGringo

+1

chrislambe avatar Dec 03 '15 23:12 chrislambe

Having the same issue as you @srcn and your codepen shows exactly the behaviour I'm seeing. The easiest way to see what's happening is to add this css to your codepen: md-backdrop { background-color: rgba(0,0,0,0.5); } and then play with the z-index.

The problem I'm having is that I can't even remove the z-index from the 'container' because it seems to be automatically added in my case. I've got a toolbar at the top of the screen which has a sidenav hamburger at the top left and then a notifications menu in the top right. This sidenav seems to stick z-index: 2 into the toolbar and then the notifications menu becomes busted.

rfuhrer avatar Dec 03 '15 23:12 rfuhrer

cc @rschmukler

jelbourn avatar Dec 04 '15 01:12 jelbourn

+1

kimsrung avatar Dec 04 '15 03:12 kimsrung

+1

gligoran avatar Dec 04 '15 09:12 gligoran