When I add a new Enhanced Input Context, a priorly pressed button keeps triggering Start and Completed actions indefinitely

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:

  1. Create an empty widget class derived from UserWidget and set its IsFocusable flag to true;
  2. Create a mapping context and an input action, add the action to the context;
  3. This is the BP setup:
  4. 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;
  5. Once the delay is over and the created widget is focused, this is the result:
    image

If you set IsFocusable to false, this doesn’t happen.

2 Likes