@@ -172,6 +172,7 @@ export default {
172172 created ( ) {
173173 // Create private non-reactive props
174174 this . $_popper = null
175+ this . $_hideTimeout = null
175176 } ,
176177 /* istanbul ignore next */
177178 deactivated ( ) /* istanbul ignore next: not easy to test */ {
@@ -184,6 +185,7 @@ export default {
184185 this . visible = false
185186 this . whileOpenListen ( false )
186187 this . destroyPopper ( )
188+ this . clearHideTimeout ( )
187189 } ,
188190 methods : {
189191 // Event emitter
@@ -249,6 +251,10 @@ export default {
249251 this . $_popper . scheduleUpdate ( )
250252 } catch { }
251253 } ,
254+ clearHideTimeout ( ) {
255+ clearTimeout ( this . $_hideTimeout )
256+ this . $_hideTimeout = null
257+ } ,
252258 getPopperConfig ( ) {
253259 let placement = PLACEMENT_BOTTOM_START
254260 if ( this . dropup ) {
@@ -288,8 +294,8 @@ export default {
288294 this . visible = false
289295 }
290296 } ,
297+ // Public method to show dropdown
291298 show ( ) {
292- // Public method to show dropdown
293299 if ( this . disabled ) {
294300 return
295301 }
@@ -299,10 +305,10 @@ export default {
299305 this . visible = true
300306 } )
301307 } ,
308+ // Public method to hide dropdown
302309 hide ( refocus = false ) {
303- // Public method to hide dropdown
310+ /* istanbul ignore next */
304311 if ( this . disabled ) {
305- /* istanbul ignore next */
306312 return
307313 }
308314 this . visible = false
@@ -386,7 +392,8 @@ export default {
386392 hideHandler ( evt ) {
387393 const { target } = evt
388394 if ( this . visible && ! contains ( this . $refs . menu , target ) && ! contains ( this . toggler , target ) ) {
389- this . hide ( )
395+ this . clearHideTimeout ( )
396+ this . $_hideTimeout = setTimeout ( ( ) => this . hide ( ) , this . inNavbar ? 300 : 0 )
390397 }
391398 } ,
392399 // Document click-out listener
0 commit comments