In UMG widgets u can make override “On Key Down/Up” for controllers and “Mouse Button Up/Down” for mouse, but it will be call only if that widget is on the screen.
EDIT: instead above, use “On Preview Key Down” and “On Preview Mouse Button Down”