From bc9a3056f5e96a00e6da991cf93de701238cdac9 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Thu, 5 Sep 2024 11:43:29 +0300 Subject: [PATCH] Work for https://github.com/surveyjs/survey-creator/issues/5783 - Weird drag behaviour to empty survey in Safari --- packages/survey-core/src/dragdrop/core.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/survey-core/src/dragdrop/core.ts b/packages/survey-core/src/dragdrop/core.ts index 11357a6ace..158c3e7084 100644 --- a/packages/survey-core/src/dragdrop/core.ts +++ b/packages/survey-core/src/dragdrop/core.ts @@ -124,15 +124,20 @@ export abstract class DragDropCore implements IDragDropEngine { protected findDropTargetNodeFromPoint(clientX: number, clientY: number): HTMLElement { const displayProp = this.domAdapter.draggedElementShortcut.style.display; - //this.domAdapter.draggedElementShortcut.hidden = true; this.domAdapter.draggedElementShortcut.style.display = "none"; - if(!DomDocumentHelper.isAvailable()) return null; + if (!DomDocumentHelper.isAvailable()) return null; - let dragOverNode = this.domAdapter.documentOrShadowRoot.elementFromPoint(clientX, clientY); - // this.domAdapter.draggedElementShortcut.hidden = false; + let dragOverNodes = >this.domAdapter.documentOrShadowRoot.elementsFromPoint(clientX, clientY); this.domAdapter.draggedElementShortcut.style.display = displayProp || "block"; + let index = 0; + let dragOverNode: HTMLElement = dragOverNodes[index]; + while (dragOverNode && dragOverNode.className.indexOf("sv-drag-target-skipped") != -1) { + index++; + dragOverNode = dragOverNodes[index]; + } + if (!dragOverNode) return null; return this.findDropTargetNodeByDragOverNode(dragOverNode);