There's a number of inconsistent behaviours when dragging block elements in the Portable Text Editor. I've opted to combine them into a single issue to reduce noise since they're all quite similar.
By 'block elements', I'm referring to custom objects or images defined within a portable text array.
Reproduction
Expected behavior
Actual behavior
Screenshots

Note that this doesn't occur if there's preceding text before the first element:

Reproduction
Expected behavior
Actual behavior
Screenshots
Note that elements are positioned correctly when the destination is adjacent to text:

Worth mentioning that when the destination is between a block element and empty linebreak, the element will be repositioned but also off by one:

Reproduction
Expected behavior
Actual behavior
You're simply unable to place a block element at the end - no target line will appear until you drag further down the page, after which it'll select the second position in the document for some reason.
This can be especially disorienting if you have a long article and can't see the target destination - users then release their cursor and the block element disappears up the page and out of view. Even more pronounced when users are dragging large images / block elements in a long portable text field.
Screenshots

Reproduction
Expected behavior
Actual behavior
Screenshots
The below above also demonstrates me deleting the full-screen header in dev tools and doing so resolves the issue, so possibly linked.

Which versions of Sanity are you using?
@sanity/cli 0.142.2 (up to date)
@sanity/base 0.142.2 (up to date)
@sanity/components 0.142.2 (up to date)
@sanity/core 0.142.2 (up to date)
@sanity/default-layout 0.142.2 (up to date)
@sanity/default-login 0.142.1 (up to date)
@sanity/desk-tool 0.142.2 (up to date)
What operating system are you using?
OS X 10.14.6
Which versions of Node.js / npm are you running?
6.9.0
v10.16.0
Thanks for this detailed report @robinpyon :heart: There's definitively some room from improvement here. We'll take a closer look at it!
Hi @robinpyon, thanks for the detailed report! We have fixed all the drag and drop issues, and they will be included in the next release.
When it comes to the enter-key behaviour on a topmost block object (non-text), that is by design, so it is possible to put some text above it. This is because we don't have a concept of the cursor being before or after a block object, it's just _on_. The alternative would be to insert the text block below as usual, but then you'd have to drag the block object down afterwards. One could however discuss which is the less painful solution/design.
Amazing – thank you!
Re: enter-key behaviour on a topmost block object – I would argue that keeping that behaviour consistent (having the text / cursor below the block) makes more sense, even if it is slightly more work for the user to add text above if that's what they desire. (Interesting to see how other editors deal with this – in dropbox paper, you simply can't add text above a topmost block element, you have to manually drag it down)
Compared to the dragging issues, this isn't really a big deal – though I'd be curious to know others' perspective on this!
Compared to the dragging issues, this isn't really a big deal – though I'd be curious to know others' perspective on this!
Yeah, me too! This is a matter of design more I guess. I must admit I agree to consistency, though I was the one that implemented the "inconsistency" :) @mariuslundgard, @kristofferj what do you think?
I agree that when a block is selected, the new line should always appear after. If you want a line on the first line (before the block), the most intuitive action would be to arrow up or click the white space over the block (so its is not selected), and press enter. The cursor could show before the block if it is necessary.
I'm closing this now, as the drag/drop bugs are taken care of in the latest release. I'll make an own internal issue for the design of the enter behaviour on the topmost void block.
Most helpful comment
I'm closing this now, as the drag/drop bugs are taken care of in the latest release. I'll make an own internal issue for the design of the enter behaviour on the topmost void block.