No <a> children of SortableElement ever triggers onClick due this:
https://github.com/clauderic/react-sortable-hoc/commit/008d8789acc23230a0ef18ccd270819a79a5250d
Reproduceable example:
https://codesandbox.io/s/xoynwoo40o
You can define a value for the distance prop on the SortableContainer.
https://github.com/clauderic/react-sortable-hoc#click-events-being-swallowed
@cusxio, thanks for the help, but it doesn't solve the problem. Once mouseDown was prevented, click will never be fired. You can see it right here: https://codesandbox.io/s/91l82zxyjr
Were you able to solve this? I'm facing the same issue.
@riccardo92 just with workarounds. We are helpless due to https://github.com/clauderic/react-sortable-hoc/commit/008d8789acc23230a0ef18ccd270819a79a5250d
Any suggestion for workaround?
It depends too much on your application and specific details. In my case, I've used the SortableHandler to make only a image below the link draggable
In my case I have added the argument pressDelay={100} to the Sortable List props. So I have :
<SortableList pressDelay={100} items={this.state.items} onSortEnd={this.onSortEnd} />
In that way you can trigger the click on the a AND drag the a less than 1 s after the click.
I changed <a> to <button> and onClick starts working
Add distance={ 2 } to your
Refer to how this component updates the value of state, because I have a delete event, click to delete one
Most helpful comment
In my case I have added the argument
pressDelay={100}to the Sortable List props. So I have :In that way you can trigger the click on the
aAND drag thealess than 1 s after the click.