I am basically running into this: [Content removed]
When performing just regular navigation to a WBP that inherits from UCommonButtonBase for reasons that cannot be clear to be SObjectWidget is the item at the top of the FocusPath. This means the KeyDown event goes to SObjectWidget, which means navigation becomes completely broken, i cannot use space or gamepad to press the button.
I have tried to set SObjectWidget and SBox to HitTestInvisible.
When UCommonButtonBase based WBPs do work the top of the FocusPath is the SButton. When UCommonButtonBase based WBPS DONT work the top of the FOcusPath is the WBP / SOBjectWidget.
How can I stop SObjectWidget from receiving the OnKeyDownEvent and being at the top of the FocusPath?
[Image Removed]
`void UMyButtonBase::NativeOnFocusChanging(const FWeakWidgetPath& PreviousFocusPath, const FWidgetPath& NewWidgetPath, const FFocusEvent& InFocusEvent)
{
Super::NativeOnFocusChanging(PreviousFocusPath, NewWidgetPath, InFocusEvent);
if (bRequiresForcedFocusFix)
{
// a bug in the hittestgrid causes the SObjectWidget of the UUserWidget to be the most focused item instead of the SButton
// cause and repro are unknown
if (NewWidgetPath.ContainsWidget(GetCachedWidget().Get()))
{
if (const TSharedPtr BoxButtonWrapper = StaticCastSharedPtr(WidgetTree->RootWidget->GetCachedWidget()))
{
if (BoxButtonWrapper->GetChildren() && BoxButtonWrapper->GetChildren()->Num() > 0)
{
if (const TSharedPtr InternalButtonSlate = StaticCastSharedPtr(TSharedPtr(BoxButtonWrapper->GetChildren()->GetChildAt(0))))
{
if (!NewWidgetPath.ContainsWidget(InternalButtonSlate.Get()))
{
FSlateApplication::Get().SetKeyboardFocus(InternalButtonSlate);
}
}
}
}
}
}
}`UMyButtonBase : public UCommonButtonBase
Here is how i found out to fix it but it is very strange.
Hi,
Apologies for the delayed response. Can you try grabbing CL#41472689 and let us know if that fixes the issue? This fix will be in the 5.6 release, and resolved a situation similar to yours where setting focus to the button directly would cause it to get stuck on the wrong widget.
Best,
Cody