floating-vue
floating-vue copied to clipboard
v-close-popper not working
Using v2.0.0-beta.17 v-close-popper doesn't work. This is due to the click handler running on the bubbling phase: https://github.com/Akryum/floating-vue/blob/86a916faa71122ef5845290f6574aced3ad44c14/packages/floating-vue/src/directives/v-close-popper.ts#L4
But the global click handler which will actually close the popper is running on capture on the window: https://github.com/Akryum/floating-vue/blob/41c31ed6606895cb40d456936c90bba140692752/packages/floating-vue/src/components/Popper.ts#L1048
So the bubbling phase click handler will set the property on the event to close the popper, but it will never reach the capture phase one as it has already ran before it.
Workaround: You can use the hide slot prop, but it does behave differently, from the directive and there is no real documentation on when either of them is recommended to be used and what the desired behavior should be.