easyblockshq / easyblocks

The open-source visual builder framework.
https://easyblocks.io
GNU Affero General Public License v3.0
346 stars 55 forks source link

fix(canvas): dont prevent clicks on actions #61

Closed maarten2424 closed 4 months ago

maarten2424 commented 5 months ago

Description

This small MR fixes the issue when clicking actions or links internally, that the event is not fired.

vercel[bot] commented 5 months ago

@maarten2424 is attempting to deploy a commit to the Shopstory Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
easyblocks-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2024 2:40pm
r00dY commented 4 months ago

How can I reproduce this issue? I checked this PR against main branch and don't see any differences but probably I'm missing something.

maarten2424 commented 4 months ago

It only triggers an event.preventDefault() when an item is active. This way you can initially click an item to make it active, and another click triggers the actual event on an element. See files changed :)

r00dY commented 4 months ago

Damn, I see it now! Took me ~30mins of debugging lol. I deployed your branch and checked out the changes ofc but couldn't reproduce it. It turns out I was checking onClick event which worked (see alert action in the demo). But it obviously didn't work for <a href />!

I'm 100% for this change. Easyblocks shouldn't prevent defaults in this way. You sometimes might want to prevent link clicks during editing, but it can be easily implemented on the component level, no need to force it globally.