diff --git a/packages/floating-vue/src/components/Popper.ts b/packages/floating-vue/src/components/Popper.ts index ef714159..fe4416c1 100644 --- a/packages/floating-vue/src/components/Popper.ts +++ b/packages/floating-vue/src/components/Popper.ts @@ -277,6 +277,11 @@ const createPopper = () => defineComponent({ type: Number, default: defaultPropFactory('disposeTimeout'), }, + + autoCloseTimeout: { + type: Number, + default: defaultPropFactory('autoCloseTimeout'), + }, }, emits: { @@ -467,12 +472,14 @@ const createPopper = () => defineComponent({ if (this.parentPopper) { this.parentPopper.lockedChild = this clearTimeout(this.parentPopper.lockedChildTimer) - this.parentPopper.lockedChildTimer = setTimeout(() => { - if (this.parentPopper.lockedChild === this) { - this.parentPopper.lockedChild.hide({ skipDelay }) - this.parentPopper.lockedChild = null - } - }, 1000) + if (this.autoCloseTimeout > 0) { + this.parentPopper.lockedChildTimer = setTimeout(() => { + if (this.parentPopper.lockedChild === this) { + this.parentPopper.lockedChild.hide({ skipDelay }) + this.parentPopper.lockedChild = null + } + }, this.autoCloseTimeout) + } } return } diff --git a/packages/floating-vue/src/config.ts b/packages/floating-vue/src/config.ts index 30a3ffa7..f4f0eaaf 100644 --- a/packages/floating-vue/src/config.ts +++ b/packages/floating-vue/src/config.ts @@ -31,6 +31,8 @@ export const config: FloatingVueConfig = { arrowPadding: 0, // Compute arrow overflow (useful to hide it) arrowOverflow: true, + // Timeout that will trigger the closing of parent popper in (ms - 0 means disabled) + autoCloseTimeout: 1000, /** * By default, compute autohide on 'click'. */