Skip to content

Commit 7d72605

Browse files
fix(b-dropdown): decrease delay when hiding inside a navbar on no-touch devices (closes #6306) (#6367)
* fixes #6306 * Update dropdown.js Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
1 parent 6dec995 commit 7d72605

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mixins/dropdown.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Popper from 'popper.js'
22
import { Vue } from '../vue'
33
import { NAME_DROPDOWN } from '../constants/components'
4+
import { HAS_TOUCH_SUPPORT } from '../constants/env'
45
import {
56
EVENT_NAME_CLICK,
67
EVENT_NAME_HIDDEN,
@@ -121,6 +122,9 @@ export const dropdownMixin = Vue.extend({
121122
// boundaries when boundary is anything other than `scrollParent`
122123
// See: https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
123124
return this.boundary !== 'scrollParent' && !this.inNavbar ? 'position-static' : ''
125+
},
126+
hideDelay() {
127+
return this.inNavbar ? (HAS_TOUCH_SUPPORT ? 300 : 50) : 0
124128
}
125129
},
126130
watch: {
@@ -386,7 +390,7 @@ export const dropdownMixin = Vue.extend({
386390
const { target } = event
387391
if (this.visible && !contains(this.$refs.menu, target) && !contains(this.toggler, target)) {
388392
this.clearHideTimeout()
389-
this.$_hideTimeout = setTimeout(() => this.hide(), this.inNavbar ? 300 : 0)
393+
this.$_hideTimeout = setTimeout(() => this.hide(), this.hideDelay)
390394
}
391395
},
392396
// Document click-out listener

0 commit comments

Comments
 (0)