Skip to content
Permalink
Browse files
fix(b-dropdown): click handling on close (closes #5982) (#6009)
* fix(b-dropdown): click handling on close

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js

* Update dropdown.js
  • Loading branch information
jacobmllr95 committed Nov 5, 2020
1 parent 2296686 commit cf7a1cb017e2263939a64e300abbbbac35c121d4
Showing 1 changed file with 11 additions and 4 deletions.
@@ -172,6 +172,7 @@ export default {
created() {
// Create private non-reactive props
this.$_popper = null
this.$_hideTimeout = null
},
/* istanbul ignore next */
deactivated() /* istanbul ignore next: not easy to test */ {
@@ -184,6 +185,7 @@ export default {
this.visible = false
this.whileOpenListen(false)
this.destroyPopper()
this.clearHideTimeout()
},
methods: {
// Event emitter
@@ -249,6 +251,10 @@ export default {
this.$_popper.scheduleUpdate()
} catch {}
},
clearHideTimeout() {
clearTimeout(this.$_hideTimeout)
this.$_hideTimeout = null
},
getPopperConfig() {
let placement = PLACEMENT_BOTTOM_START
if (this.dropup) {
@@ -288,8 +294,8 @@ export default {
this.visible = false
}
},
// Public method to show dropdown
show() {
// Public method to show dropdown
if (this.disabled) {
return
}
@@ -299,10 +305,10 @@ export default {
this.visible = true
})
},
// Public method to hide dropdown
hide(refocus = false) {
// Public method to hide dropdown
/* istanbul ignore next */
if (this.disabled) {
/* istanbul ignore next */
return
}
this.visible = false
@@ -386,7 +392,8 @@ export default {
hideHandler(evt) {
const { target } = evt
if (this.visible && !contains(this.$refs.menu, target) && !contains(this.toggler, target)) {
this.hide()
this.clearHideTimeout()
this.$_hideTimeout = setTimeout(() => this.hide(), this.inNavbar ? 300 : 0)
}
},
// Document click-out listener

0 comments on commit cf7a1cb

Please sign in to comment.