Vue-material: Menu can't be closed if menu is in sidenav

Created on 12 Jan 2017  路  6Comments  路  Source: vuematerial/vue-material

when menu is in sidenav and open, it can not be closed on click sidenav.

bug

Most helpful comment

Awesome. Thank you, Its a great library

All 6 comments

Same thing for <md-select> (which uses <md-menu>). I have been trying to find a solution but so far no luck. The JQuery below prevents the menu from opening at all.

$(document).on("click",".md-sidenav-content",function(){
    if ( $(".md-select-content").hasClass("md-active") ){
        $(".md-select-content").remove();
    }
})

This JQuery closes a menu in a sidenav, but only works once. After the first time, the menu will not re-open.

$(document).on("mousedown",".md-sidenav-content",function(){
    if ($(".md-menu-content.md-active").length ){
        $(".md-menu-content.md-active").remove();
    }
})

This one seems to work :) It allows <md-select> in sidenav with click-on-sidenav to close the <md-menu>

$(document).on("mousedown",".md-sidenav-content",function(){
   if ($(".md-menu-content.md-active").length ){
      $("div.md-backdrop.md-menu-backdrop.md-transparent.md-active").click();
   }
})

@jkirkland-cityoflewisville-com Thank you for the workaround, but I will try to fix it in a Vue.js way. It is a bug :(

Awesome. Thank you, Its a great library

Hey,

I think this is the same like a select menu not closing inside a dialog.
This is because the z-index of the backdrop of the menu is smaller/equal the z-index of dialog-backdrop/sidenav-backdrop (set the z-index of the menu higher in dev tools and it closed like expected)

Since this is done via css, it is not so dynamic.
I think you need to recalculate the z-index in JS (incrementing it for nested elements)

** Maybe also wrap the menu-content + backdrop in a div (like with dialog)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

korylprince picture korylprince  路  3Comments

markus-s24 picture markus-s24  路  3Comments

bryanspearman picture bryanspearman  路  3Comments

Feduch picture Feduch  路  3Comments

andreujuanc picture andreujuanc  路  3Comments