Dropdown close when click away
I have multiple dropdowns inside a collapsable element.
When the dropdown is opened and to prevent the collapse I've added stop propagation
x-on:click.stop="toggle"
The problem is that multiple dropdowns can now be opened. Is there a way of using Alpines click away to close the dropdown?
E.g
2 Replies
@click.outside="close"
?Cheers but that's triggered for every click on the page and when the dropdown is not open it throws an error.
can't access property "setAttribute", t.trigger is nullFrom
panel2.trigger.setAttribute("aria-expanded", false);
from alpine-tooltip