4.9 Bug: Button blocks cursor keys

I’m using the cursor keys to move my character around (just like WASD does).
If I have a button in my HUD and click on this Button, cursor keys seem to be hard coded to navigate into the UI. So pressing e.g ‘Left’ in this situation does not move my character anymore. To be able to move again, I’ve to click into the game window again.
I already tried to disable focus on buttons and tried all values in the ‘Navigation’ tab of the button (in Designer) for Left/Right/Up/Down/Next/Previous.

Is it possible to get around that hard coded functionality?
Thank you.

Hello ,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any blueprints that may be involved with this issue?

Hello Rudy,

thanks for helping.
Steps to reproduce:

1.) Create a new FirstPerson C++ project.

2.) Besides WASD, set the cursor keys as motion input for your character in the project settings

3.) Subclass C++ class ‘MyUserWidget’ from UUserWidget

4.) Subclass blueprint ‘BP_MyUserWidget’ from ‘MyUserWidget’

5.) add 2 Buttons to ‘BP_MyUserWidget’ in the designer tab

6.) compile and start play

7.) click on one of the buttons

8.) notice that you cannot walk anymore using the cursor keys, but WASD still works. This is the bug. It should still be possible to use the cursor keys to move the character.

Hello ,

After reading over your steps provided this appears to be working as intended. The button is supposed to capture the mouse input. If you would like to make it so that you mouse does not interact with a widget you could use the visibility setting “Self Hit invisible” I hope that this information helps.

Make it a great day

Hello Rudy,

this is not about mouse input.
This is about keyboard input from the cursor keys.

58981-capture.jpg

Usually located here:

58982-keyboard.jpg

Hello ,

Thanks for the clarification, I was able to reproduce this issue on our end. I have written up a report (UE-21174) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your information and time.

Make it a great day

Thank you very much!

Working as intended. If you don’t want the UI to consume navigation keys, don’t place focus on the UI. Buttons by default are focusable, and will take focus when clicked. So change the button to not be focusable. The arrow keys are navigation keys that shift focus between UI elements, so that keyboard and controller input can be used to navigate the UI.

Already mentioned in my question that I tried that already. I did that by unchecking this in the designer:

59046-capture.jpg

This didn’t help. Is there some UMG function ala UnFocusUI() or something that I can call after each button-click? Perhaps that would help.

I have absolutly same issue. In my RTS game, when I click on HUD button I can not pan map anymore using arrows. I tested all Input Modes and also my buttons are not Focusable… it is really annoying for players and there needs to be someway how to disable this functionality.

SetFocusToGameViewport will put focus back on the viewport widget. If it’s not the buttons, you probably have another widget higher up that’s becoming focused, user widgets can also be made focusable. You could enable always showing the focus rectangle in your user interface project settings to see which widget has the focus. I believe the widget reflector also has this capability.

Thanks for helping, Nick.
Your idea with the focus rectangle helped me to experiment.

I now think the problem is the viewport widget. If it has focus, player navigation with cursor keys does not work. If no widget (including the viewport widget) has focus, cursor keys work as expected.
If viewport widget has focus, clicking once into the game window has the desired effect of ‘unfocussing’ all widgets (including viewport widget).

2 pics for clarification:

one click later…

Yes I have a problem with this when trying to rebind actions to the arrow keys. I have click on screen where there’s no buttons first then is will take an arrow key but because the mouse button is binded to shoot I’ll get a conflict error before I can rebind to the arrow key.

after doing that I can see its not moving between the buttons but still have to click on the background image to bind an arrow key

Hello fallenHere,

I have provided a link to the public tracker. If you visit the link you will see that this issue was closed as “By Design”. I hope that this information helps.

Link: Unreal Engine Issues and Bug Tracker (UE-21174)

Make it a great day

all I get from that is, I having this problem in 4.11.2, so from 4.9.1 to 4.11.2 no solution for this problem has been found. I just started working on a new project and one of the first things they want me to do is fix the projects key binding, and I’ll be having the same problem. I’m gonna try using a popup widget with no buttons to see if that works.

I have provided a link to documentation that goes over the nodes used to set input. The nodes such as “Set input game only” will help you manage your inputs. I hope that this information helps.

Link: Creating Widgets in Unreal Engine | Unreal Engine 5.1 Documentation