logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: cb135645f9b290944c40052f09a3eb9a487598a1
parent 9c9dc2053b68813f748bc7cd656987242f45158c
Author: Henry Jameson <me@hjkos.com>
Date:   Mon, 27 Jun 2022 19:16:33 +0300

make hover popovers less annoying to close

Diffstat:

Msrc/components/popover/popover.js8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js @@ -45,6 +45,10 @@ const Popover = { inject: ['popoversZLayer'], // override popover z layer data () { return { + // lockReEntry is a flag that is set when mouse cursor is leaving the popover's content + // so that if mouse goes back into popover it won't be re-shown again to prevent annoyance + // with popovers refusing to be hidden when user wants to interact with something in below popover + lockReEntry: false, hidden: true, styles: {}, oldSize: { width: 0, height: 0 }, @@ -202,6 +206,7 @@ const Popover = { }, onMouseenter (e) { if (this.trigger === 'hover') { + this.lockReEntry = false clearTimeout(this.graceTimeout) this.graceTimeout = null this.showPopover() @@ -213,7 +218,8 @@ const Popover = { } }, onMouseenterContent (e) { - if (this.trigger === 'hover') { + if (this.trigger === 'hover' && !this.lockReEntry) { + this.lockReEntry = true clearTimeout(this.graceTimeout) this.graceTimeout = null this.showPopover()