In 3.10.2 x-if and @click.away behave differently than 2.3.0 #2877
Unanswered
hugoalvarado
asked this question in
5. Bugs
Replies: 2 comments
-
This is between v2 and v3. The correct event, in v3 is to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I noticed that in 3.10.2 the click away modifier is triggered when clicking the element itself.
In 2.x the click away modifier is triggered only when clicking outside the template. This combined with x-if is resulting in odd behavior.
In my case I use x-if with a flag to show a menu and then @click.away to hide it.
A button toggles the flag, showing the menu, and then the menu hides itself when the user clicks outside. This does not work in 3.10.
I have examples below where the only difference is the alpine versions
With Alpinejs 2.3.0: https://jsfiddle.net/Lsxb13t5/4/
With Alpinejs 3.10.2: https://jsfiddle.net/Lsxb13t5/5/
Code from jsfiddle:
Beta Was this translation helpful? Give feedback.
All reactions