logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 85de0927faf5cece654c6816bd43f77114f0b4df
parent 8979548ed8aa8255ddf7d2f7647eb3d2663087c2
Author: Henry Jameson <me@hjkos.com>
Date:   Mon, 13 Jun 2022 01:30:20 +0300

recalculate position on scrolls

Diffstat:

Msrc/components/popover/popover.js16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js @@ -195,8 +195,8 @@ const Popover = { if (this.$el.contains(e.target)) return this.hidePopover() }, - onScroll () { - this.hidePopover() + onScroll (e) { + this.updateStyles() } }, updated () { @@ -210,13 +210,17 @@ const Popover = { this.oldSize = { width: content.offsetWidth, height: content.offsetHeight } } }, - created () { + mounted () { + let scrollable = this.$refs.trigger.closest('.column.-scrollable') + if (!scrollable) scrollable = window document.addEventListener('click', this.onClickOutside) - window.addEventListener('scroll', this.onScroll) + scrollable.addEventListener('scroll', this.onScroll) }, - unmounted () { + beforeUnmount () { + let scrollable = this.$refs.trigger.closest('.column.-scrollable') + if (!scrollable) scrollable = window document.removeEventListener('click', this.onClickOutside) - window.removeEventListener('scroll', this.onScroll) + scrollable.removeEventListener('scroll', this.onScroll) this.hidePopover() } }