Desired result
I want the item to be clickable link. BUT also IF the user moves the item by dragging it to disable the click. Im not sure how to access the javascript event.
The sorting works... but adding the link to the element it sends the page as soon as the dragging stops/drops
Setup
I am using Livewire Sortable.js, its a wrapper for SortableJS so apparently all the options [the functions too?] are available somehow?
I did add... forceFallback which prevent html5 from hijacking my styling.
I also saw this post where someone just wired up sortablejs directly to use Livewire. If I rewrote the logic to use sortablejs directly, idk.
How can I prevent the default click action when moving and allow it to click otherwise?
Here is the code
nothing special... I tried adding preventOnFilter to the options...
<div
wire:sortable="updateToolOrder"
wire:sortable.options="{ forceFallback: true, preventOnFilter: true }">
@foreach($project->activeTools as $tool)
<x-dynamic-component :$tool :component="'project.tool.card-'. $tool->modelName()" />
@endforeach
</div>
and a basic render of the dynamic component...
<div class"relative ..." wire:sortable.item="12" wire:key="tool-12">
<h3>Card title</h3>
<div class="flex overflow-hidden">
// just some card content
</div>
<a href="a url here" class="absolute inset-0"></a>
</div>