-
I'm encountering a strange issue - not sure it's a bug or not. When using x-trap and click.stop to create a modal, any click.outside helpers don't appear to work within the scope of click.stop and therefore within the modal.
After opening the menu, clicking on 'some other modal content' doesn't trigger click.outside. However, clicking outside the scope of click.stop does trigger click.outside. Is click.stop incompatible with a nested click.outside? I've even tried this using the Alpine Components - placing the dropdown component into the content area of the modal component and the same problem is encountered - you can't close the dropdown by clicking elsewhere in the modal. I've put this simple example in codepen if that helps illustrate better. https://codepen.io/stuartdiack/pen/XWVpGpG Apologies if this is not a bug and instead is expected behaviour, but knowing that would help me look for another approach to have menus within modals. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ye, they are incompatible. The outside modifier creates a listener on document (top element of your page, when the even reaches that point, Alpine checks who generate the event). The stops modifier prevent an event from bubbling up the dom. |
Beta Was this translation helpful? Give feedback.
Ye, they are incompatible. The outside modifier creates a listener on document (top element of your page, when the even reaches that point, Alpine checks who generate the event). The stops modifier prevent an event from bubbling up the dom.