# Close menu with same button as opening

**URL:** <https://forums.unrealengine.com/t/close-menu-with-same-button-as-opening/485710>\
**Category:** UI\
**Tags:** menu-creation, unreal-engine, menu, UI, question, Blueprint\
**Created:** [July 3, 2021, 1:58pm UTC](https://forums.unrealengine.com/t/close-menu-with-same-button-as-opening/485710 "2021-07-03T13:58:33Z")\
**Posts on this page:** 1\
**Showing post:** 10

<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:** [July 4, 2021, 8:04am UTC](https://forums.unrealengine.com/t/close-menu-with-same-button-as-opening/485710/10 "2021-07-04T08:04:02Z")

</div>

Not stupid at all, actually. It’s just an input processing thing.

`Set Input Mode UI Only` prevents the Player Controller from processing input - pressing M while this mode is active does nothing, the PC ignores it, as instructed. The input is processed in the widget instead since we’ve given it to the UI exclusively - `Set Input Mode UI Only`

You can have it processed by both (widgets go first, though) with `Set Input Mode Game and UI` node but if you’re making a first person shooter kind of game (we don’t know it here) you may not want to do this.

In order to make the same key work seamlessly (the way _I think_ you want it to work,) you’ll need the following:

In the player (or wherever you press M to open the menu):

 ![343140-screenshot-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/0/2706e4aac4c98d07c182441c755cd3b6e5afdf24.png)

- the above either creates or shows the widget, it does not close it
- the below is processed in the widget - this closes the menu:

 ![343185-screenshot-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/1/51103a4ff25277cb943bb8f3bdfe3681856e1f58.png)

- the override is here:

 ![343183-keydown.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/4/df4a69e6877473650700e428b5d9cc6333ea532e.png)

- and you need to make the widget keyboard focusable:

![343184-screenshot-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/e/bae3a5a9f8dc86290925605d00c72dc346cf5298.png)

---

_[View the full topic](https://forums.unrealengine.com/t/close-menu-with-same-button-as-opening/485710)._
