Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/base/src/util/dragAndDrop/DragRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ const MIN_MULTI_DRAG_COUNT = 2;

let draggedElement: HTMLElement | null = null;

const setDraggedElement = (element: HTMLElement | null) => {
const setDraggedElement = (element: HTMLElement | null, e?: DragEvent) => {
draggedElement = element;

// Store the dragged element's ID in the dataTransfer object to ensure
// the drag operation is recognized across different browsers and contexts.
// Without this, Safari browser in iOS may not recognize the drag operation.
e?.dataTransfer?.setData("text/plain", element ? element.id : "");
};

const clearDraggedElement = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ abstract class ListItem extends ListItemBase {
}

if (e.target === this._listItem) {
DragRegistry.setDraggedElement(this);
DragRegistry.setDraggedElement(this, e);
this.setAttribute("data-moving", "");
e.dataTransfer.dropEffect = "move";
e.dataTransfer.effectAllowed = "move";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class Tab extends UI5Element implements ITabbable, ITab {

_ondragstart(e: DragEvent) {
if (e.target instanceof HTMLElement) {
DragRegistry.setDraggedElement(this);
DragRegistry.setDraggedElement(this, e);
e.target.setAttribute("data-moving", "");
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/TabContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class TabContainer extends UI5Element {
e.dataTransfer.dropEffect = "move";
e.dataTransfer.effectAllowed = "move";

DragRegistry.setDraggedElement((e.target as TabInStrip).realTabReference);
DragRegistry.setDraggedElement((e.target as TabInStrip).realTabReference, e);
}

_onHeaderDragEnter(e: DragEvent) {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/TableDragAndDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class TableDragAndDrop extends TableExtension {
}

_ondragstart(e: DragEvent) {
DragRegistry.setDraggedElement(e.target as HTMLElement);
DragRegistry.setDraggedElement(e.target as HTMLElement, e);
}

_ondragend() {
Expand Down
Loading