(e: DragEvent)
| 278 | }; |
| 279 | |
| 280 | let onDragLeave = (e: DragEvent) => { |
| 281 | e.preventDefault(); |
| 282 | e.stopPropagation(); |
| 283 | |
| 284 | // We would use e.relatedTarget to detect if the drag is still inside the drop target, |
| 285 | // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547 |
| 286 | // Instead, we track all of the targets of dragenter events in a set, and remove them |
| 287 | // in dragleave. When the set becomes empty, we've left the drop target completely. |
| 288 | // We must also remove any elements that are no longer in the DOM, because dragleave |
| 289 | // events will never be fired for these. This can happen, for example, with drop |
| 290 | // indicators between items, which disappear when the drop target changes. |
| 291 | |
| 292 | let target = getEventTarget(e); |
| 293 | state.dragOverElements.delete(target); |
| 294 | |
| 295 | // Only remove stale elements when leaving the drop target itself. |
| 296 | // Avoids issues with portal children bubbling dragleave events through the React tree. |
| 297 | if (target === e.currentTarget) { |
| 298 | for (let element of state.dragOverElements) { |
| 299 | if (!nodeContains(e.currentTarget, element)) { |
| 300 | state.dragOverElements.delete(element); |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | if (state.dragOverElements.size > 0) { |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | if (state.dropEffect !== 'none') { |
| 310 | fireDropExit(e); |
| 311 | } |
| 312 | |
| 313 | clearTimeout(state.dropActivateTimer); |
| 314 | }; |
| 315 | |
| 316 | let onDrop = (e: DragEvent) => { |
| 317 | e.preventDefault(); |
nothing calls this directly
no test coverage detected