Pressing a UMG button releases every currently pressed input

This worked for me.

In the project settings, uncheck “Should Flush Pressed Keys on Viewport Focus Lost”

Found in this post thanks to @bigstumpy