[Webkit-unassigned] [Bug 242627] New: event.relatedTarget is always null for dragenter and dragleave events
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jul 11 19:12:19 PDT 2022
https://bugs.webkit.org/show_bug.cgi?id=242627
Bug ID: 242627
Summary: event.relatedTarget is always null for dragenter and
dragleave events
Product: WebKit
Version: Safari 15
Hardware: Mac (Apple Silicon)
OS: macOS 12
Status: NEW
Severity: Normal
Priority: P2
Component: UI Events
Assignee: webkit-unassigned at lists.webkit.org
Reporter: alexreardon at gmail.com
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
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220712/9070bebf/attachment-0001.htm>
More information about the webkit-unassigned
mailing list