From d9caabc468232c39f4c6bae9f18611a2f014a1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=94=D0=BE?= =?UTF-8?q?=D0=B2=D0=B1=D0=BD=D1=8F?= Date: Mon, 8 Feb 2021 12:35:18 +0300 Subject: [PATCH] Check event.target is exist If the popover is open and an event is emitted in the code (new Event('click')), then I get the error. Example https://codesandbox.io/s/upbeat-sid-ccvu8?file=/src/components/HelloWorld.vue --- src/components/Popover.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Popover.vue b/src/components/Popover.vue index 1d0a1674..ec9055a9 100644 --- a/src/components/Popover.vue +++ b/src/components/Popover.vue @@ -705,7 +705,7 @@ function handleGlobalClose (event, touch = false) { for (let i = 0; i < openPopovers.length; i++) { const popover = openPopovers[i] if (popover.$refs.popover) { - const contains = popover.$refs.popover.contains(event.target) + const contains = !!event?.target && popover.$refs.popover.contains(event.target) requestAnimationFrame(() => { if (event.closeAllPopover || (event.closePopover && contains) || (popover.autoHide && !contains)) { popover.$_handleGlobalClose(event, touch)