Skip to content

Commit 455f614

Browse files
authored
fix(ui5-upload-collection): fire drop only when files are dropped within dnd overlay (#2527)
1 parent 5470e23 commit 455f614

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

packages/fiori/src/UploadCollection.hbs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="ui5-uc-root">
1+
<div class="ui5-uc-root" @drop="{{_ondrop}}">
22
<div class="ui5-uc-header">
33
<slot name="header"></slot>
44
</div>
@@ -24,7 +24,6 @@
2424
@dragenter="{{_ondragenter}}"
2525
@dragleave="{{_ondragleave}}"
2626
@dragover="{{_ondragover}}"
27-
@drop="{{_ondrop}}"
2827
>
2928
<ui5-icon name="upload-to-cloud"></ui5-icon>
3029
<span class="dnd-overlay-text">{{_dndOverlayText}}</span>

packages/fiori/src/UploadCollection.js

+16
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ const metadata = {
125125
},
126126
},
127127
events: /** @lends sap.ui.webcomponents.fiori.UploadCollection.prototype */ {
128+
/**
129+
* Fired when an element is dropped inside the drag and drop overlay.
130+
* <br><br>
131+
* <b>Note:</b> The <code>drop</code> event is fired only when elements are dropped within the drag and drop overlay and ignored for the other parts of the <code>ui5-upload-collection</code>.
132+
*
133+
* @event sap.ui.webcomponents.fiori.UploadCollection#drop
134+
* @readonly
135+
* @param {DataTransfer} dataTransfer The <code>drop</code> event operation data.
136+
* @public
137+
*/
138+
drop: {},
139+
128140
/**
129141
* Fired when the Delete button of any item is pressed.
130142
* <br><br>
@@ -250,6 +262,10 @@ class UploadCollection extends UI5Element {
250262
return;
251263
}
252264

265+
if (event.target !== this.shadowRoot.querySelector(".uc-dnd-overlay")) {
266+
event.stopPropagation();
267+
}
268+
253269
this._dndOverlayMode = UploadCollectionDnDOverlayMode.None;
254270
}
255271

0 commit comments

Comments
 (0)