Skip to content
Permalink
Browse files

fix(MdMenu): fix close-on-select props (#1280)

check whether clicked target is contained in menu content element within `bodyClickObserver`

fix #1279
  • Loading branch information...
VdustR authored and marcosmoura committed Dec 19, 2017
1 parent 1cfaf3c commit 40406aff38e717aeb6c2cfd0a563f14d256d4e35
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/components/MdMenu/MdMenuContent.vue
@@ -7,7 +7,8 @@
@keydown.arrow-down.prevent="setHighlight('down')"
@keydown.arrow-up.prevent="setHighlight('up')"
@keydown.space.prevent="setSelection"
@keydown.enter.prevent="setSelection">
@keydown.enter.prevent="setSelection"
ref="menu">
<div class="md-menu-content-container md-scrollbar" :class="$mdActiveTheme">
<md-list :class="listClasses" v-bind="$attrs" @keydown.esc="onEsc">
<slot />
@@ -188,7 +189,8 @@
this.MdMenu.bodyClickObserver = new MdObserveEvent(document.body, 'click', $event => {
$event.stopPropagation()
let isMdMenu = this.MdMenu.$el ? this.MdMenu.$el.contains($event.target) : false
if (!this.$el.contains($event.target) && !isMdMenu) {
let isMenuContentEl = this.$refs.menu ? this.$refs.menu.contains($event.target) : false
if (!this.$el.contains($event.target) && !isMdMenu && !isMenuContentEl) {
this.MdMenu.active = false
this.MdMenu.bodyClickObserver.destroy()
this.MdMenu.windowResizeObserver.destroy()

0 comments on commit 40406af

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