# Consistent UMG navigation with mouse, keyboard, or gamepad?

**URL:** <https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4-27, question, UMG\
**Created:** [April 6, 2022, 5:58pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735 "2022-04-06T17:58:18Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [April 14, 2022, 3:46pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/21 "2022-04-14T15:46:57Z")

</div>

really interesting, I should give this a go some time. thanks for the details!

---

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [April 19, 2022, 1:24pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/22 "2022-04-19T13:24:07Z")

</div>

So I’m considering using borders right now and was wondering, how do you trigger border hovering when they don’t have that event?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 19, 2022, 1:25pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/23 "2022-04-19T13:25:11Z")

</div>

I override onMouseEnter / Leave for the base widget class.

---

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [April 19, 2022, 1:28pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/24 "2022-04-19T13:28:09Z")

</div>

oh, neat.

may I ask how about keyboard navigation, since borders aren’t focusable?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 19, 2022, 1:36pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/25 "2022-04-19T13:36:40Z")

</div>

The root of the widget is focusable.

---

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [April 19, 2022, 1:45pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/26 "2022-04-19T13:45:46Z")

</div>

oh snap, of course!

thank you again 😃

---

<div class="post-metadata">

**Author:** ![fael097](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fael097/32/250778_2.png) [@fael097](https://forums.unrealengine.com/u/fael097)\
**Post date:** [April 20, 2022, 4:20am UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/27 "2022-04-20T04:20:58Z")

</div>

So I was trying to use borders instead of buttons to fix this issue I’m having, where I want to be able to, while in a menu, detect input mode as keyboard or gamepad to show the appropriate button icon

(described here: [Arrow keys don't trigger any key event when input mode is set to game + ui (or just ui) - #10 by Seda145](https://forums.unrealengine.com/t/arrow-keys-dont-trigger-any-key-event-when-input-mode-is-set-to-game-ui-or-just-ui/525736/10))

but it turns out that if any sort of widget is capable of being focused, as soon as it’s focused it will automatically change the game mode to UI, and disable any default UI navigation key (keyboard arrows, gamepad d-pad, etc) from triggering key input events in any blueprint, so any attempt at detecting input doesn’t work while I’m navigating a menu.

do you have any form of input method detection to change button icons in your custom ui?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 20, 2022, 7:12am UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/28 "2022-04-20T07:12:18Z")

</div>

Never did anything with keyboard navigation in mind. Not as a main goal.

> but it turns out that if any sort of widget is capable of being focused, as soon as it’s focused it will automatically change the game mode to UI

The input mode is not changing. If you’re in the `Input Mode Game & UI`, the focused widget gets the priority to process the input. If unhandled there, the Player Controller will have a go. Standard stuff.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/7/3578edaa30147ff907a70a4c23a520ffbeec33c0.png)

That’s how it has always worked. I took it for a spin and something must have changed recently. It seems that widgets lose focus in a weird way.

- in the controller:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/b/3dbd71361f2557746f178fabe9ac7b34278524c7.png)

- in the widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/a/e4aa7db9fcac544301c3e8a3986817e7f08e150a.png)

This will Print both messages _only_ if I _force_ the widget to keep focus:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/2/9f23754ca91ec37ac15a2e2e6d1489b1904ac188.png)

But the widget stops processing stuff due to focus lost. I mean, technically speaking, getting the attention of the controller _should_ make the widget lose focus.

* * *

This is something that the regular buttons are really good at - stealing and keeping focus. I developed my UI in order to _avoid_ that. You’re doing the opposite thing.

* * *

> do you have any form of input method detection to change button icons in your custom ui?

That should be happening in the onFocusReceived.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 20, 2022, 7:47am UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/29 "2022-04-20T07:47:25Z")

</div>

Not sure if that would work in your case, but you can always fall back on dictating an explicit behaviour:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/e/f6e2a9a3b18a3adaab1351fc557b1de8107c732c.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/0/42013119735b67884986a96dae1b97fe76f0de14.png)

Above, the icon is changing during onFocusLost / Received in the customBorder.

This also gives you direct control over where the focus goes:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/6/aa618fbc73a9bacc3239592c41746c85b058fd43.png)

* * *

Never fully understood how `Escape` and `Wrap` rules are supposed to work _outside_ of containers. 😑

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [April 20, 2022, 12:17pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/30 "2022-04-20T12:17:08Z")

</div>

> [@Everynone](#):
>
> > do you have any form of input method detection to change button icons in your custom ui?
> 
> That should be happening in the onFocusReceived.

I have suggested using an Input Processor (“FSlateApplication::RegisterInputPreProcessor”) in the related post. Because if you want to update the entire UI and not just the focused widget, you need this.

> [@Arrow keys don't trigger any key event when input mode is set to game + ui (or just ui)](https://forums.unrealengine.com/t/arrow-keys-dont-trigger-any-key-event-when-input-mode-is-set-to-game-ui-or-just-ui/525736/12):
>
> Not impossible, you can still detect the input device through an input processor and work from there.

---

<div class="post-metadata">

**Author:** ![eobet](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eobet/32/465239_2.png) [@eobet](https://forums.unrealengine.com/u/eobet)\
**Post date:** [July 16, 2022, 2:41pm UTC](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735/31 "2022-07-16T14:41:47Z")

</div>

Wasn’t Unreal 5 going to improve this?

I’ve also rolled my own entire input handling and menu navigation, but in one case it seems I had to use a built-in button and I managed to work around it, but now I’ve ended up with a reproducible bug that’s just a showstopper for me… guess I’ll try to remove the button widget entirely, but I’m trying to stick with 100% blueprints here…

[Previous page](https://forums.unrealengine.com/t/consistent-umg-navigation-with-mouse-keyboard-or-gamepad/516735.md?page=1)
