Skip to content

Commit

Permalink
fix(b-dropdown): decrease delay when hiding inside a navbar on no-tou…
Browse files Browse the repository at this point in the history
…ch devices (closes #6306) (#6367)

* fixes #6306

* Update dropdown.js

Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
  • Loading branch information
andrei-gheorghiu and jacobmllr95 committed Jan 27, 2021
1 parent 6dec995 commit 7d72605
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mixins/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Popper from 'popper.js'
import { Vue } from '../vue'
import { NAME_DROPDOWN } from '../constants/components'
import { HAS_TOUCH_SUPPORT } from '../constants/env'
import {
EVENT_NAME_CLICK,
EVENT_NAME_HIDDEN,
Expand Down Expand Up @@ -121,6 +122,9 @@ export const dropdownMixin = Vue.extend({
// boundaries when boundary is anything other than `scrollParent`
// See: https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
return this.boundary !== 'scrollParent' && !this.inNavbar ? 'position-static' : ''
},
hideDelay() {
return this.inNavbar ? (HAS_TOUCH_SUPPORT ? 300 : 50) : 0
}
},
watch: {
Expand Down Expand Up @@ -386,7 +390,7 @@ export const dropdownMixin = Vue.extend({
const { target } = event
if (this.visible && !contains(this.$refs.menu, target) && !contains(this.toggler, target)) {
this.clearHideTimeout()
this.$_hideTimeout = setTimeout(() => this.hide(), this.inNavbar ? 300 : 0)
this.$_hideTimeout = setTimeout(() => this.hide(), this.hideDelay)
}
},
// Document click-out listener
Expand Down

0 comments on commit 7d72605

Please sign in to comment.