I’m trying to create a menu that can be navigated through keyboard/controller only.
Right now, the issue I’m running into is the menu widget losses focus if there’s a click input from the mouse. It doesn’t seem to matter if the mouse has been captured, hidden, or if an input mode is specified. Steps to reproduce:
Create empty level
Create widget blueprint
Add button to widget
Display widget in level (as per LevelBlueprint.png the button will have focus from the keyboard)
Launch game in New Editor Window
Following these steps gets the button focused and responds to keyboard input, which can be verified by using the Widget Reflector (Window → Developer Tools → Widget Reflector, then check “Show Focus”) but once the viewport has been clicked the keyboard will lose focus (BeforeClick.png and AfterClick.png).
I’ve tried just about every solution I can find to no avail. The closest I’ve come to resolving the issue was through the very similar post [bug] losing focus when clicking in level view - UI - Unreal Engine Forums
The conclusion in that answer section was:
“I made a blueprint exposed function that looksup the currently focused widget and sets a focus reply event. I called it keepfocushandled which returns an event reply for the mouse down event. This works fine, although this solves my mouse click issues i found thst keyboard navigation can also cause the viewport to receive focus. It would be great if you guys would show an umg example which supports keyboard, gamepad and mouse navigation.”
I’m uncertain as to how you can look up the currently focused widget however. I’m at a loss.
Any help would be greatly appreciated!