Okay, I dug deeper into the engine code and seem to have found the issue.
The thing is, if you have a focusable widget and it’s being focused, something else gets unfocused, which eventually results in calling FlushPressedKeys()
in PlayerController.cpp
and PlayerInput.cpp
, and for some reason it starts triggering this weird behavior as described in the first message.
You can easily reproduce the issue as follows:
- Create an empty widget class derived from UserWidget and set its
IsFocusable
flag totrue
; - Create a mapping context and an input action, add the action to the context;
- This is the BP setup:
- Press and release the key that triggers the delay, then press and hold the key that was bound to the action in the mapping context;
- Once the delay is over and the created widget is focused, this is the result:
If you set IsFocusable
to false
, this doesn’t happen.