According to my reading of the [drag and drop spec](https://html.spec.whatwg.org/multipage/dnd.html#dnd), as well as the behaviour of Chrome and Firefox, `dragenter` and `dragleave` events are supposed to set the related target event property (`event.relatedTarget`). - `dragenter`: `event.relatedTarget` is the previous _current target element_ (where the drag is coming from) - `dragleave`: `event.relatedTarget` is the new _current target element_ (where the drag has gone too) When dragging into a window: `event.relatedTarget` should be `null` on `dragenter` When dragging out of a window: `event.relatedTarget` should be `null` on `dragleave` In Safari, for `dragenter` and `dragleave` events, the `event.relatedTarget` property is _always_ `null`. This is unhelpful. Doing this makes it painful to detect when a drag is entering / exiting the window. Reproduction case: - sandbox: https://codesandbox.io/s/event-relatedtarget-for-dragenter-and-dragleave-safari-bug-gpph01 - independent example: https://gpph01.csb.app/ As a work around you need to count `dragenter` and `dragleave` events to determine whether a drag is entering / leaving a window
This bug is related to: https://bugs.webkit.org/show_bug.cgi?id=66547 But that bug was only for the `dragleave` event
As mentioned, generalising the other bug to cover both events. *** This bug has been marked as a duplicate of bug 66547 ***