Skip to content
Permalink
Browse files

fix(MdMenu): Close menu while another is opened (#1266)

Remove `stopPropagation` from `MdMenu` to trigger close-menu click observer

fix #1255
  • Loading branch information...
VdustR authored and marcosmoura committed Dec 6, 2017
1 parent 9073313 commit ef720c4c024f21f5425c5fb566eaa39c948209db
Showing with 5 additions and 4 deletions.
  1. +3 −2 src/components/MdMenu/MdMenu.vue
  2. +2 −2 src/components/MdMenu/MdMenuContent.vue
@@ -57,7 +57,8 @@
dense: this.mdDense,
closeOnSelect: this.mdCloseOnSelect,
bodyClickObserver: null,
windowResizeObserver: null
windowResizeObserver: null,
$el: this.$el
}
}
},
@@ -105,11 +106,11 @@
},
methods: {
toggleContent ($event) {
$event.stopPropagation()
this.MdMenu.active = !this.MdMenu.active
}
},
async mounted () {
this.MdMenu.$el = this.$el
await this.$nextTick()
this.triggerEl = this.$el.querySelector('[md-menu-trigger]')
@@ -187,8 +187,8 @@
if (document) {
this.MdMenu.bodyClickObserver = new MdObserveEvent(document.body, 'click', $event => {
$event.stopPropagation()
if (!this.$el.contains($event.target)) {
let isMdMenu = this.MdMenu.$el ? this.MdMenu.$el.contains($event.target) : false
if (!this.$el.contains($event.target) && !isMdMenu) {
this.MdMenu.active = false
this.MdMenu.bodyClickObserver.destroy()
this.MdMenu.windowResizeObserver.destroy()

0 comments on commit ef720c4

Please sign in to comment.
You can’t perform that action at this time.