-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/draggable only when can drag #3187
Fix/draggable only when can drag #3187
Conversation
* check monitor for draggable * versioning strategy with patch on changed repo and declined on all others * fix: use string type for setting html attribute * fix: always set the draggable attribute on connectDragSource * fix: update semver doc Co-authored-by: Chris Trevino <chtrevin@microsoft.com>
I've just updated from 14.0.3 to 15.1.0 and suddenly my components are no longer draggable after initial drop. I've just done some quick debugging and it seems that the fix is to set canDrag to be true in the useDrag hook. Previously I had omitted canDrag because the doc suggests it's optional. Is the doc out of date and I now need to set canDrag or is there something else I am missing? I'm not sure if my issues relates to this particular change so apologies if not and it deserves it's own issue. |
This is misleading. I was running in dev mode with hot reload when I made this change and suddenly my components were draggable again after initial drop. Fresh app start with the same change and they are no longer draggable after initial drop. I think there's something else going on here. I'll have to debug further tomorrow. |
It appears that any change inside the useDrag hook makes components draggable again when in dev mode with hot reload, e.g. a random console.log inside item makes them draggable again. Fresh restart and components are no longer draggable again. |
Issue appears to be with react-dnd-html5-backend library. 14.1.0 is the last working version. All other versions I can no longer drag more than once. |
@dmbarry86 - that is really strange- the examples I have on hand all appear to work properly. Can you draft up an example? |
See #3378 |
fixes #2909
I saw the same issue as mentioned in the PR and propose the fix in this PR.
When the attribute is set to
"true"
whilecanDrag
isfalse
, some (or perhaps all, but I cannot vouch for that) browsers will still allow the user to drag the node.react-dnd
does not appear to consider it as being dragged and will not employ the same drop behavior, but it would be preferable to have the attribute matchcanDrag
.