# Drag & Drop Widget disappears after pressing ESC

**URL:** <https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106>\
**Category:** UI\
**Tags:** key, drag-and-drop, unreal-engine, Widget, question\
**Created:** [August 28, 2017, 6:28pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106 "2017-08-28T18:28:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b3639a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b3639a6](https://forums.unrealengine.com/u/anonymous_user_4b3639a6)\
**Post date:** [August 28, 2017, 6:28pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/1 "2017-08-28T18:28:21Z")

</div>

Hey guys,

is there a function which delegates key events while a Drag & Drop Operation is currently active?

My Widgets just disappears when I press Escape while drag and dropping it.  
I hoped my NativeOnDragCancelled function would be called but this is not the case 😕

Thanks in advance for your answers

Greetings

---

<div class="post-metadata">

**Author:** ![Vallynne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vallynne](https://forums.unrealengine.com/u/Vallynne)\
**Post date:** [December 27, 2017, 4:35pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/2 "2017-12-27T16:35:27Z")

</div>

Hello McStrife,

I’m encountering the same issue in 4.18.1. When I press escape my drag and drop operation disappears and Drag Cancelled is not being called leaving me unable to handle the event. Were you able to solve this on your own somehow?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b3639a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b3639a6](https://forums.unrealengine.com/u/anonymous_user_4b3639a6)\
**Post date:** [December 28, 2017, 2:05pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/3 "2017-12-28T14:05:03Z")

</div>

Unfortunately not. ☹

---

<div class="post-metadata">

**Author:** ![Vallynne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vallynne](https://forums.unrealengine.com/u/Vallynne)\
**Post date:** [December 28, 2017, 4:14pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/4 "2017-12-28T16:14:48Z")

</div>

If it is of any help, I was able to solve this with a workaround.

Instead of removing the original widget from the parent when D&D operation begins, I keep it in place and unchanged until OnDrop is registered for the operation, and only then perform all the necessary changes. In this case I don’t need any extra logic on Cancel events and cancelling via Escape becomes no different to any other way of cancelling the drag.  
The original widget is used as a payload for the D&D operation so it can be easily referenced.

The only downside I see is visual, as the widget stays in the original place while the operation is ongoing. In my case I made the D&D visual slightly transparent to make it stand out from the original widget and that was it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b3639a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b3639a6](https://forums.unrealengine.com/u/anonymous_user_4b3639a6)\
**Post date:** [December 29, 2017, 10:47am UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/5 "2017-12-29T10:47:56Z")

</div>

You could duplicate the Widget. Attach it the the D&D Op and make the original wiget invisible.  
If you drop it anywhere else you delete the original widget. That could be one way to do it.

My problem is that I don’t get any D&D event when ESC is pressed (while dragging). I filled the OnDragCancelled function but unfortunately it won’t be called ☹

---

<div class="post-metadata">

**Author:** ![mirakuru420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mirakuru420](https://forums.unrealengine.com/u/mirakuru420)\
**Post date:** [January 13, 2018, 6:44pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/6 "2018-01-13T18:44:50Z")

</div>

Same behavior on my side. 4.18.1

---

<div class="post-metadata">

**Author:** ![raianlp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@raianlp](https://forums.unrealengine.com/u/raianlp)\
**Post date:** [July 25, 2018, 2:06pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/7 "2018-07-25T14:06:43Z")

</div>

The same issue here. I press ESC while drag&dropping and corresponding drag&drop widget disappearch. UE 4.18.3

---

<div class="post-metadata">

**Author:** ![lionclopeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lionclopeg](https://forums.unrealengine.com/u/lionclopeg)\
**Post date:** [March 4, 2019, 3:03am UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/8 "2019-03-04T03:03:30Z")

</div>

Lol. Same on 4.19.2  
Is it possible to use `On key event` to resolve this?

---

<div class="post-metadata">

**Author:** ![mirakuru420](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mirakuru420](https://forums.unrealengine.com/u/mirakuru420)\
**Post date:** [March 4, 2019, 12:24pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/9 "2019-03-04T12:24:16Z")

</div>

4.21.1 The problem still remains.

---

<div class="post-metadata">

**Author:** ![ColWTPhilmore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ColWTPhilmore](https://forums.unrealengine.com/u/ColWTPhilmore)\
**Post date:** [November 18, 2024, 11:09pm UTC](https://forums.unrealengine.com/t/drag-drop-widget-disappears-after-pressing-esc/403106/10 "2024-11-18T23:09:46Z")

</div>

Looks like it’s a very old bug and devs gave up on it?  
There must be way to override esc key during drag and write my own implementation
