Every time I open or close the widget, I have to click on the screen to make it work.

I’ve solved this for every version since 4.x. But it’s different every time.

You showed us all three states of Input mode. Which one are you using for the UI?

In your project settings under Engine/Input, can you show a screenshot of your settings for Viewport Properties? In most cases, this should be set to “Capture Permanently Including Initial Mouse Down”.

Also, your widget must be set to be focusable. This is why I like CommonUI because it takes care of all the focus issues and you can set a default focused sub widget. If you’re just using the regular widgets, you have to do this manually. There should be a checkbox or something somewhere.

A problem with using BP to set the Input Mode is that it changes your capture settings. So what you should do is find a setting in the projects settings that works the first time you try to bring up the UI. Once you have that, you must add nodes after setting the Input Mode to restore those settings especially the capture mode. So as weird as it sounds, you have to use “Set Viewport Mouse Capture Mode” AFTER setting the input mode to restore the capture mode to what you used to have.

Then you can work on the Game Only mode (or whatever is it you’re using when the UI isn’t up).

In 5.4, you don’t even use capture mode anymore. You just use UI input config and it’s a lot easier.