UI. Changing focus while holding accept key.

In a simple 2 button setup, when you focus on one button and press accept key(Enter or A on Xbox gamepad) you get on pressed event, this is completely fine, but when moving focus to another button, while still holding interaction key you get pressed event on second button, after releasing the key you get clicked event. This seems strange, I would expect it to discard input event after changing focus and call pressed and clicked events only if you press input key inside focused widget. Video.

Changing buttons press method doesn’t help. After investigating engine logic I saw that FSlateApplication::ProcessKeyDownEvent and SButton::OnKeyDown are called every frame, while you are holding the key.

Also checked Fortnite and there it works as I expected, changing focus resets interaction status.

So is there a setting/workarond for this, or I need to customize engine to get the behaviour I’m expecting?

In FKeyEvent struct passed to OnKeyDown method there is a bool bIsRepeat, it can be used to detect if this is a first event or an auto-repeated keystroke.