From e3b9c00d5e1bfadc0e1e1bcd06c43cf53035f0c0 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 8 Jun 2022 03:22:15 +0300 Subject: [PATCH] hide popovers on scroll --- src/components/popover/popover.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index c65689bd1a..09e07b4c88 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -168,6 +168,9 @@ const Popover = { if (this.hidden) return if (this.$el.contains(e.target)) return this.hidePopover() + }, + onScroll () { + this.hidePopover() } }, updated () { @@ -183,9 +186,11 @@ const Popover = { }, created () { document.addEventListener('click', this.onClickOutside) + window.addEventListener('scroll', this.onScroll) }, unmounted () { document.removeEventListener('click', this.onClickOutside) + window.removeEventListener('scroll', this.onScroll) this.hidePopover() } }