vue3-popper icon indicating copy to clipboard operation
vue3-popper copied to clipboard

How can we close the popper on something like a scroll event?

Open fergusmeiklejohn opened this issue 3 years ago • 3 comments

This is a great library, thanks for building it! I'm wondering how we can close the popper without implementing full manual control?

Problem: I need to close the popper on scroll, but want to retain the default open/close functionality of the component, so I don't want to eject to full manual control.

fergusmeiklejohn avatar Nov 08 '21 03:11 fergusmeiklejohn

Thanks for this, I see your problem. Maybe it's possible to keep using the internal functionality while using v-model or the .sync modifier - that way you would keep all the default functionality while still being able to manually control the Popper.

I'll take a look at this.

valgeirb avatar Nov 08 '21 08:11 valgeirb

Thanks! Yes the beauty of the component is that it implements all that default open/close functionality, which we wouldn't want to lose to be able to get some manual control.

fergusmeiklejohn avatar Nov 09 '21 01:11 fergusmeiklejohn

i got the same issue (close popper manually without full open/close control), and this is my workaround:

<Popper :show="showPopper"> ... </Popper>

const hidePopper = () => { showPopper.value = false; nextTick(() => { showPopper.value = null; }); };

https://codesandbox.io/s/vue3-popper-manually-close-workaround-umrcf

srr3 avatar Dec 08 '21 11:12 srr3