mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 00:11:45 +03:00
Fix list widget reordering (#10654)
Fixes, but does not close #10651 - I will try adding some e2e tests for dragging (again). The problem is, that removing/hiding element in the same frame as dragging starts, the drag is stopped immediately. It is presented here: https://jsfiddle.net/1g34jhe9/ (change `HIDE_IN_NEXT_FRAME` to compare). In our case, the element removal was technically postponed to `nextTick`, but that is not enough after some version bump, as this tick occures after DOM recalculating, not necessarily after _rendering_ - changed it to setTimeout with proper comment.
This commit is contained in:
parent
e5b85bf16e
commit
82052e81aa
@ -183,11 +183,13 @@ function onDragStart(event: DragEvent, index: number) {
|
||||
|
||||
const metaMime = encodeMetadataToMime(meta)
|
||||
event.dataTransfer.setData(metaMime, '')
|
||||
nextTick(() => {
|
||||
// The code below will remove the item from list; because doing it in the same frame ends drag
|
||||
// immediately, we need to put it in setTimeout (nextTick is not enough).
|
||||
setTimeout(() => {
|
||||
updateItemBounds()
|
||||
draggedIndex.value = index
|
||||
dropInfo.value = { meta, position: currentMousePos }
|
||||
})
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user