First and foremost I would like to mention that none of my UMG widgets have ‘Is Focusable’ set to true, which is apparently what a number of people are having trouble with concerning this odd keyboard interaction.
For some reason the widget still seems to be picking up keyboard input and treating the space bar specifically as a click. Is there a way to disable the space bar altogether or fix this issue in another way?
In a blueprint widget you can override the function On Preview Key Down and from the input In Key Event call Get Key and use the function Equal (Key) to compare it to the space bar. If true, then you can use the function Handled to create an Event Reply for the return node so it won’t do anything; otherwise, you can use the function Unhandled so it will be processed normally.
This solved this for me. I had a custom button widget that I made to support tooltips and other logic. It wasnt enough to have the W_Button focusable unchecked. Had to go into the W_Button and uncheck it there also. Hope that makes sense to anyone lol
In my case, setting IsFocusable to false was not a desirable solution. I ended up updating FSlateApplication’s UINavigation key event map to prevent space bar to act as “accept” event.
void UHueroFunctionLibraryWidget::InitializeGlobalUINavigationConfig()
{
const auto& SlateApp = FSlateApplication::Get();
const auto Config = SlateApp.GetNavigationConfig();
// In our game we want space bar to be used to go back.
Config->KeyActionRules.Remove(EKeys::SpaceBar);
Config->KeyActionRules.Add(EKeys::SpaceBar, EUINavigationAction::Back);
}
In my setup, I call this function in game instance init event.