simplesmiler / vue-clickaway

Reusable clickaway directive for reusable Vue.js components
MIT License
963 stars 77 forks source link

Sometimes not working #47

Open amrap030 opened 4 years ago

amrap030 commented 4 years ago

Hello,

I have a dropdown menu in a component I want to close on clickaway. The same dropdown menu exists in another component. When I click the button of the dropdown menu in the first component and after that the button of the dropdown menu in the other component both dropdowns are open. I would expect to have the first dropdown to close when I click on the second dropdown. But when I do it the other way around the expected behaviour is correct.

How can I fix this?

dmbaranov commented 4 years ago

Hey @amrap030! I'm facing the same issue. Have you solved it somehow?

oriati commented 3 years ago

I'm having similar issues, in my case the clickaway isn't registered when the outside click is on vue-bootstrap's dropdown trigger. I managed to replicate this behavior, it seems that if the outside click has stopPropagation - then the clickaway fails. I found this issue https://github.com/simplesmiler/vue-clickaway/issues/19#issuecomment-379545937 that says exactly that.. so make sure you don't stop the event propagation in your click