You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a back end developer and JS makes my head hurt.
However, after a few hours of mucking about trying to get the menus to toggle visible:invisible, I realised that the issue was which element the @click.away method was on.
TL;DR: Move the @click.away() method up to the as in the code below
MOVE THE LINE @click.away="closeProfileMenu"
<ul
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click.away="closeProfileMenu". // <--- THIS ONE
@keydown.escape="closeProfileMenu"
TO THE '<button> ELEMENT ABOVE <template> HERE:
<button
class="align-middle rounded-full focus:shadow-outline-purple focus:outline-none" @click="toggleProfileMenu"
@click.away="closeProfileMenu". // <--- PUT IT HERE
@keydown.escape="closeProfileMenu"
aria-label="Account"
aria-haspopup="true">
Oh, and it seems that Alpine now calls @click.away@click.outside.
Hope that saves someone else hours of scratching their heads!
The text was updated successfully, but these errors were encountered:
I am a back end developer and JS makes my head hurt.
However, after a few hours of mucking about trying to get the menus to toggle visible:invisible, I realised that the issue was which element the @click.away method was on.
TL;DR: Move the @click.away() method up to the as in the code below
MOVE THE LINE
@click.away="closeProfileMenu"
<ul
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click.away="closeProfileMenu". // <--- THIS ONE
@keydown.escape="closeProfileMenu"
TO THE
'<button>
ELEMENT ABOVE<template>
HERE:<button
class="align-middle rounded-full focus:shadow-outline-purple focus:outline-none"
@click="toggleProfileMenu"
@click.away="closeProfileMenu". // <--- PUT IT HERE
@keydown.escape="closeProfileMenu"
aria-label="Account"
aria-haspopup="true">
Oh, and it seems that Alpine now calls
@click.away
@click.outside
.Hope that saves someone else hours of scratching their heads!
The text was updated successfully, but these errors were encountered: