# WasInputKeyJustReleased not working when widget has keyboard focus ?

**URL:** <https://forums.unrealengine.com/t/wasinputkeyjustreleased-not-working-when-widget-has-keyboard-focus/787693>\
**Category:** Programming & Scripting\
**Tags:** Input, unreal-engine, mouse-event, question\
**Created:** [March 10, 2023, 7:34am UTC](https://forums.unrealengine.com/t/wasinputkeyjustreleased-not-working-when-widget-has-keyboard-focus/787693 "2023-03-10T07:34:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 10, 2023, 7:34am UTC](https://forums.unrealengine.com/t/wasinputkeyjustreleased-not-working-when-widget-has-keyboard-focus/787693/1 "2023-03-10T07:34:39Z")

</div>

Hello,

I have to manually manage the focus between viewport and various widgets.  
I’m setting/unsetting the focus with calls like those:

> hoveredWidget-\>GetWidget()-\>SetKeyboardFocus();  
> FSlateApplication::Get().SetUserFocusToGameViewport(0, EFocusCause::SetDirectly);

And i’m using the player controller’s functions to check which inputs are up/down:

> WasInputKeyJustPressed(EKeys::LeftMouseButton)  
> WasInputKeyJustReleased(EKeys::LeftMouseButton)  
> IsInputKeyDown(EKeys::LeftMouseButton)

And the likes.

My problem is that as soon as i set the keyboard focus on a widget, the PC’s functions cease to work correctly and give incorrect information.  
For example, IsInputKeyDown gives a false while i’m pressing the button, WasInputKeyJustRelease is called right after i click the button, things like that.

I suspect somehow the widget stop propagating the info to the PC, or maybe setting the focus automatically releases the mouse button ?

Anyway, is there a way to have those function correctly working independantly of who has the focus ? Like forcing the widget to let the info get to the PC, or trap the info before it gets caught by the widget ?

Thanks  
Cedric

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 10, 2023, 12:03pm UTC](https://forums.unrealengine.com/t/wasinputkeyjustreleased-not-working-when-widget-has-keyboard-focus/787693/2 "2023-03-10T12:03:39Z")

</div>

I tried to not use the PC functions and use instead the widget delegates NativeOnMouseButtonDown and NativeOnMouseButtonUp.

Now the plot thickens, as NativeOnMouseButtonDown works well, while NativeOnMouseButtonUp is never called.

Cedric
