+11
-4
lines changedFilter options
+11
-4
lines changed Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ export default {
172
172
created() {
173
173
// Create private non-reactive props
174
174
this.$_popper = null
175
+
this.$_hideTimeout = null
175
176
},
176
177
/* istanbul ignore next */
177
178
deactivated() /* istanbul ignore next: not easy to test */ {
@@ -184,6 +185,7 @@ export default {
184
185
this.visible = false
185
186
this.whileOpenListen(false)
186
187
this.destroyPopper()
188
+
this.clearHideTimeout()
187
189
},
188
190
methods: {
189
191
// Event emitter
@@ -249,6 +251,10 @@ export default {
249
251
this.$_popper.scheduleUpdate()
250
252
} catch {}
251
253
},
254
+
clearHideTimeout() {
255
+
clearTimeout(this.$_hideTimeout)
256
+
this.$_hideTimeout = null
257
+
},
252
258
getPopperConfig() {
253
259
let placement = PLACEMENT_BOTTOM_START
254
260
if (this.dropup) {
@@ -288,8 +294,8 @@ export default {
288
294
this.visible = false
289
295
}
290
296
},
297
+
// Public method to show dropdown
291
298
show() {
292
-
// Public method to show dropdown
293
299
if (this.disabled) {
294
300
return
295
301
}
@@ -299,10 +305,10 @@ export default {
299
305
this.visible = true
300
306
})
301
307
},
308
+
// Public method to hide dropdown
302
309
hide(refocus = false) {
303
-
// Public method to hide dropdown
310
+
/* istanbul ignore next */
304
311
if (this.disabled) {
305
-
/* istanbul ignore next */
306
312
return
307
313
}
308
314
this.visible = false
@@ -386,7 +392,8 @@ export default {
386
392
hideHandler(evt) {
387
393
const { target } = evt
388
394
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)
390
397
}
391
398
},
392
399
// Document click-out listener
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4