MDL-79829 core: Reactive drag and drop cursor

* When dragging and dropping an item, the cursor should be
set to "move" and not copy.
This commit is contained in:
Laurent David 2024-02-01 09:35:26 +01:00
parent 38a3310c92
commit 9497db441a
3 changed files with 4 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -283,7 +283,7 @@ export default class extends BaseComponent {
position.y = event.offsetY;
}
event.dataTransfer.setDragImage(dragImage, position.x, position.y);
event.dataTransfer.effectAllowed = 'copyMove';
this._callParentMethod('dragStart', dropdata, event);
}
@ -347,6 +347,7 @@ export default class extends BaseComponent {
*/
_dragOver(event) {
const dropdata = this._processEvent(event);
event.dataTransfer.dropEffect = (event.altKey) ? 'copy' : 'move';
if (dropdata && !this.dropzonevisible) {
this.dropzonevisible = true;
this.element.classList.add(this.classes.DRAGOVER);