Skip to content

Commit abdeb3b

Browse files
wuramboRambo Wu
andauthored
fix Safari bug with dropping element inside grid (#1738)
* fix Safari bug with dropping element inside grid Co-authored-by: Rambo Wu <rambo.wu@tanium.com>
1 parent 860b844 commit abdeb3b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/h5/dd-droppable.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt
105105

106106
/** @internal called when the item is leaving our area, stop tracking if we had moving item */
107107
private _dragLeave(event: DragEvent): void {
108+
// Note: Safari Mac has null relatedTarget which causes #1684 so check if DragEvent is inside the grid instead
109+
if (!event.relatedTarget) {
110+
const { bottom, left, right, top } = this.el.getBoundingClientRect();
111+
if (event.x < right && event.x > left && event.y < bottom && event.y > top) return;
112+
}
108113
if (this.el.contains(event.relatedTarget as HTMLElement)) return;
109114
this._removeLeaveCallbacks();
110115
if (this.moving) {

0 commit comments

Comments
 (0)