Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/MdMenu/MdMenuContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down Expand Up @@ -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()
Expand Down