DnD: dragging won't start on first attempt (when no events are visible when initialized?)
See original GitHub issueDo you want to request a feature or report a bug?
bug
What’s the current behavior?
This took me quite some time to simulate, so bear with my explanation.
Problem is, that DnD at some cases seems to be not fully initialized and then is not working on each odd attempt. Problem can be easily seen here: https://codesandbox.io/s/640nmy650r
- If I set defaultDate to be at the same week as events, DnD is working.
- If I set defaultDate to start at some other week without events, then after navigation via Previous/Next controls to events, DnD won’t start on each odd attempt. Every second attempt works.
In depth in first attempt I saw that drag is not started due to beforeSelect check, where state accessible via dragAndDropAction
is not yet filled. Maybe issue with event listeners?
I had this problem starting in WEEK and DAY view (maybe it’s also issue with MONTH). !Beware: hot reload causes correct re-initialization, so you need to refresh whole page before each try.
Problem is not connected to OS or browser.
What’s the expected behavior?
DnD works no matter what defaultDate
and view
is used.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:13 (5 by maintainers)
Top Results From Across the Web
DnD: dragging won't start on first attempt (when no events are ...
To reproduce, click on the button at the top to enable dragging, then try to drag. The first drag fails, and then works...
Read more >Drag operations - Web APIs | MDN
Starting a drag operation In this example, we add a listener for the dragstart event by using the addEventListener() method. When a user...
Read more >html drag/drop setDragImage doesnt set ghost image on first ...
I can successfully drag the div to the canvas and drop the image fine, however my problem is whilst dragging the ghost image...
Read more >How to implement drag and drop in React with React DnD
We'll drag the Image component and drop it onto another Image component, making our job a little easier. To implement this, use the...
Read more >7.7 Drag and drop — HTML5 - W3C
First, the dragenter event, which is used to determine whether or not the drop target is to accept the drop. If the drop...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I seem to be able to confirm this bug. Here’s how:
onSelectSlot
to create a new event and update theevents
stateevents
does not contain events that will render on initial loadIf the
events
array has one or more items in it that will be rendered, everything works fine; otherwise, the move/resize events only work every other time, and other strange behavior occurs also.Consider the following code:
In the above example, the drag and drop functionality will not work properly for newly created events. However, if I simply change the initial state of
events
to a Date range that will be rendered initially, everything works fine:So, with the above change, everything works normally again.
until the official fix is coming, I’m using this workaround
Do you guys have any feedback? Can I use this right now?