How to cancel drag-and-drop with ESC key?


Apologies if this is obvious but I couldn't find it anywhere.  How can I allow the user to press ESC to cancel a drag-and-drop operation (with DragAndDropContainer and DragAndDropTarget)?


Coincidentally, I just hit this same requirement for tracktion, so will figure something out v. soon!


Is there a way to achieve this behavior currently?


It works already doesn’t it?
The only time I’ve not seen it work is with the standalone target for a plugin, where you need to have the file over the app window for Escape to work (on macOS 10.12 at least).


Not sure about the file drag and drop, but we’re using DragAndDropContainer and DragAndDropTarget for re-ordering UI items and there’s no way to cancel a drag once you start it (without just dropping the item back in the same location or off to the side)


Could you listen for an esc keypress and use that to toggle what the result of isInterestedInDragSource would be?