Space bar is acting like click with my UMG widget

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.

4 Likes