# \[CommonUI\] Issue with SetFocus and CommonButtonBase Slate button

**URL:** <https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Widget, CPP, question\
**Created:** [August 10, 2023, 4:57am UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399 "2023-08-10T04:57:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TPagerie\_Moclo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TPagerie\_Moclo](https://forums.unrealengine.com/u/TPagerie_Moclo)\
**Post date:** [August 10, 2023, 4:57am UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399/1 "2023-08-10T04:57:57Z")

</div>

Hello!

I’m having a weird issue with CommonUI and the **UCommonButtonBase** when using the fonction “SetFocus” on it.

For what I’ve investigate, it seems like the **UCommonButtonBase** create with _ConstructInternalButton()_ a **UCommonButtonInternalBase** and wraps itself in it to manage and override all the click, hover… etc events.

Using the SlateDebugger, I’ve track the focused elements when navigate in my interface and found some weird behavior.

My issue is that when I use SetFocus to try to focus a **UCommonButtonBase** (or any inherited class) it focus the CommonButtonBase instance, and not the InternalButton (called _InternalRootButtonBase_).  
Therefore, it doesn’t fire any hover or click event, since it’s managed by the internalButton.

However, if I navigate in my list of buttons, I can see that Unreal default navigation focus the InternalButton, fireing any event I love 😃

So I have a list of button, Set focus on the first in the Activated Event of the Widget, can’t click it with Gamepad, doesn’t have the Hover event. Navigate to the one just bellow, everything works find, go back to my first button, once again, everything is find, meaning that the issue is around the SetFocus.

(I’ve tried to be a smart hacky boy, by focusing the InternalButton in the Focus event of the CommonButton, but it says that it’s not focusable… even after setting it to true litteraly one line above)

So does anyone had the issue and know what’s not working here?

Thanks for future help !

---

<div class="post-metadata">

**Author:** ![EA-KJacques](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EA-KJacques](https://forums.unrealengine.com/u/EA-KJacques)\
**Post date:** [November 3, 2023, 2:25am UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399/2 "2023-11-03T02:25:16Z")

</div>

I am having the same exact issue. Have you figured out a workaround? I’ve been on this for a hot minute now.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ZerbuTabek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ZerbuTabek](https://forums.unrealengine.com/u/ZerbuTabek)\
**Post date:** [August 3, 2024, 6:58pm UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399/3 "2024-08-03T18:58:11Z")

</div>

This problem still exists. After searching for a solution for hours, I gave up and just went back to using a normal Button widget and manually implementing any functionality I need. I hope this gets fixed eventually, especially since cross-platform input is one of CommonUI’s most touted features.

---

<div class="post-metadata">

**Author:** ![Captain\_Cox1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Captain\_Cox1](https://forums.unrealengine.com/u/Captain_Cox1)\
**Post date:** [May 8, 2025, 1:04am UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399/4 "2025-05-08T01:04:12Z")

</div>

I spent a day looking into this same problem. I found something that works, but requires editing the CommonUI plugin code.

Simply add these to CommonButtonBase.h/cpp:

`COMMONUI_API TSharedPtr<SButton> GetSlateButton() const;`

`UFUNCTION(BlueprintCallable, Category = "Common Button")`  
`COMMONUI_API void SetFocusOnRootButton();`

cpp file:

`TSharedPtr<SButton> UCommonButtonInternalBase::GetSlateButton() const`  
`{`  
`	return MyCommonButton;`  
`}`

`void UCommonButtonBase::SetFocusOnRootButton()`  
`{`  
`	FSlateApplication::Get().SetKeyboardFocus(RootButton->GetSlateButton());`  
`}`

Then call SetFocusOnRootButton on your CommonButtonBase instead of SetFocus.  
If there’s some way to retrieve the Slate button from UMG then you could get around having to modify the plugin. Not sure how to do that though.

---

<div class="post-metadata">

**Author:** ![P3Tii009](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@P3Tii009](https://forums.unrealengine.com/u/P3Tii009)\
**Post date:** [August 14, 2025, 3:29pm UTC](https://forums.unrealengine.com/t/commonui-issue-with-setfocus-and-commonbuttonbase-slate-button/1256399/5 "2025-08-14T15:29:37Z")

</div>

If anyone else runs into this issue, here’s how I worked around it. Example code is at the bottom.

We have 2 problems. The first is that `RootButton` is private inside **UCommonButtonBase**. The second is that `MyCommonButton` inside **UCommonButtonInternalBase** is `protected`. These two make it so you can’t access it directly from your own button class.

**Here is how I fixed this:**

1. **Subclass `UCommonButtonInternalBase`**

- In your subclass, create a getter function that returns `MyCommonButton`.
- This lets you safely expose it for later use.

1. **Override `ConstructInternalButton()` in your button class (which inherits from `UCommonButtonBase`)**

- This function is `protected` and `virtual`, so you can create your own subclass of **UCommonButtonInternalBase** instead of the default internal button.
- At the same time, you can cache a pointer to your custom internal button so you can use it later.

1. **Override `NativeOnFocusReceived()`**

- When your button receives focus, you can forward that focus directly to the actual Slate button (`MyCommonButton`) using the getter you exposed earlier.
- This ensures the Slate widget behaves correctly when navigating with keyboard or controller.

**This way you don’t need to touch the Common UI’s plugin code, which I really wanted to avoid.**

Here’s what that looks like in code:

**Header file:**

```auto
UCLASS()
class UCustomCommonButtonInternalBase : public UCommonButtonInternalBase
{
	GENERATED_BODY()

public:
	TSharedPtr<SCommonButton> GetSlateButton() const { return MyCommonButton; }
};

UCLASS()
class UCustomCommonButton : public UCommonButtonBase
{
	GENERATED_BODY()
	
protected:
	UPROPERTY(Transient)
	TObjectPtr<UCustomCommonButtonInternalBase> CachedInternalButton{};
	
	virtual UCommonButtonInternalBase* ConstructInternalButton() override;

	virtual FReply NativeOnFocusReceived(const FGeometry& InGeometry, const FFocusEvent& InFocusEvent) override;
};

```

**CPP file:**

```auto
UCommonButtonInternalBase* UCustomCommonButton::ConstructInternalButton()
{
	CachedInternalButton = WidgetTree->ConstructWidget<UCustomCommonButtonInternalBase>(
		UCustomCommonButtonInternalBase::StaticClass(),
		FName(TEXT("InternalRootButtonBase"))
	);
	return Cast<UCommonButtonInternalBase>(CachedInternalButton);
}

FReply UCustomCommonButton::NativeOnFocusReceived(const FGeometry& InGeometry, const FFocusEvent& InFocusEvent)
{
	Super::NativeOnFocusReceived(InGeometry, InFocusEvent);
	
	if (CachedInternalButton->GetSlateButton())
	{
		FSlateApplication::Get().SetKeyboardFocus(CachedInternalButton->GetSlateButton());
		return FReply::Handled();
	}

	return FReply::Unhandled();
}

```
