Click event delegation to avoid page link

Hi,

I have a parent container (more precisely, a custom component) to which I attributed a “Link” to “Page”. Now into this parent, I also have a specific button to show a contextual menu. So naturally when I click on this child, I’m redirected to the page given by the parent because I actually clicked on it…

But how can I overwrite the action to operate, not to go on page, but just change my showContextMenu variable ? That is to say, I want to be redirected to the page if I click on this component, except if I click on the button ?

I searched a bit around adding a event.preventDefault() on page load, but nothing conclusive, maybe I did it wrong (see on screenshot).

I hope this question can help others.

Thanks !

Screenshot 2024-03-29 at 10.54.16

Hey!

You are on the right track! You have an action Stop click propagation that you need to add at the beginning of your workflow.
CleanShot 2024-03-29 at 11.13.27

1 Like

Indeed… I was not conscious of the feature… thanks !!

Hey, i used “Stop click propagration”, but it seems that it works only sometimes, when i spam click my Link it will still redirect me, any idea how to fix that?

Hey @SilasCG
Can you share a video/screenshot of how things are built on your situation?

Hello,

I forgot the previous answer, but I’ve encountered the issue again. Please find attached some screenshots of my situation. Thank you!

Hey @SilasCG :slight_smile:
I think some context would help. How is the parent of your element configured? Can you make a quick video showing all of that?