Skip to content

Commit

Permalink
fix: check for contains before requestAnimationFrame, closes #253
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Apr 28, 2019
1 parent 1659ce5 commit 1a486f2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/Popover.vue
Expand Up @@ -674,17 +674,16 @@ function handleGlobalTouchend (event) {
function handleGlobalClose (event, touch = false) {
// Delay so that close directive has time to set values
requestAnimationFrame(() => {
let popover
for (let i = 0; i < openPopovers.length; i++) {
popover = openPopovers[i]
if (popover.$refs.popover) {
const contains = popover.$refs.popover.contains(event.target)
for (let i = 0; i < openPopovers.length; i++) {
let popover = openPopovers[i]
if (popover.$refs.popover) {
const contains = popover.$refs.popover.contains(event.target)
requestAnimationFrame(() => {
if (event.closeAllPopover || (event.closePopover && contains) || (popover.autoHide && !contains)) {
popover.$_handleGlobalClose(event, touch)
}
}
})
}
})
}
}
</script>

0 comments on commit 1a486f2

Please sign in to comment.