Skip to content

Commit 4db912c

Browse files
authored
List drag image no longer has a background (microsoft#172641)
1 parent da0309f commit 4db912c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/vs/base/browser/ui/list/listView.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,9 +1101,18 @@ export class ListView<T> implements IListView<T> {
11011101

11021102
const dragImage = $('.monaco-drag-image');
11031103
dragImage.textContent = label;
1104-
document.body.appendChild(dragImage);
1104+
1105+
const getDragImageContainer = (e: HTMLElement | null) => {
1106+
while (e && !e.classList.contains('monaco-workbench')) {
1107+
e = e.parentElement;
1108+
}
1109+
return e || document.body;
1110+
};
1111+
1112+
const container = getDragImageContainer(this.domNode);
1113+
container.appendChild(dragImage);
11051114
event.dataTransfer.setDragImage(dragImage, -10, -10);
1106-
setTimeout(() => document.body.removeChild(dragImage), 0);
1115+
setTimeout(() => container.removeChild(dragImage), 0);
11071116
}
11081117

11091118
this.domNode.classList.add('dragging');

0 commit comments

Comments
 (0)