Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu hides when hovering over menu item after hovering over submenu #1052

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions packages/floating-vue/src/components/Popper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ const createPopper = () => defineComponent({
type: Number,
default: defaultPropFactory('disposeTimeout'),
},

autoCloseTimeout: {
type: Number,
default: defaultPropFactory('autoCloseTimeout'),
},
},

emits: {
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions packages/floating-vue/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
*/
Expand Down