Skip to content

Commit

Permalink
Moving observers to setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
hastom committed Apr 23, 2020
1 parent d8110e4 commit 273d754
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/components/MdMenu/MdMenuContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

<script>
import MdComponent from 'core/MdComponent'
import MdPropValidator from 'core/utils/MdPropValidator'
import MdObserveEvent from 'core/utils/MdObserveEvent'
import MdResizeObserver from 'core/utils/MdResizeObserver'
import MdPopover from 'components/MdPopover/MdPopover'
Expand Down Expand Up @@ -76,13 +75,12 @@
shouldRender (shouldRender) {
if (shouldRender) {
this.setPopperSettings()
this.$nextTick().then(() => {
setTimeout(() => {
this.setInitialHighlightIndex()
this.createClickEventObserver()
this.createResizeObserver()
this.createKeydownListener()
})
}, 0)
}
}
},
Expand Down Expand Up @@ -207,8 +205,7 @@
if (document) {
this.MdMenu.bodyClickObserver = new MdObserveEvent(document.body, 'click', $event => {
$event.stopPropagation()
if (!this.isMenuContentEl($event) && (this.MdMenu.closeOnClick || this.isBackdropExpectMenu($event))) {
if (!this.isMenu($event) && (this.MdMenu.closeOnClick || !this.isMenuContentEl($event))) {
this.MdMenu.active = false
this.MdMenu.bodyClickObserver.destroy()
this.MdMenu.windowResizeObserver.destroy()
Expand Down

0 comments on commit 273d754

Please sign in to comment.