Skip to content

Commit

Permalink
Work for surveyjs/survey-creator#5783 - Weird drag behaviour to empty…
Browse files Browse the repository at this point in the history
… survey in Safari
  • Loading branch information
tsv2013 committed Sep 5, 2024
1 parent fbc011c commit bc9a305
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/survey-core/src/dragdrop/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ export abstract class DragDropCore<T> 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 = <HTMLElement>this.domAdapter.documentOrShadowRoot.elementFromPoint(clientX, clientY);
// this.domAdapter.draggedElementShortcut.hidden = false;
let dragOverNodes = <Array<HTMLElement>>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);
Expand Down

0 comments on commit bc9a305

Please sign in to comment.