When focus changes an IE_Released event occurs for the W key (your character stops moving) due to UGameViewportClient::LostFocus calling APlayerController::FlushPressedKeys. Because of the R key press windows stops sending repeat WM_KEYDOWN messages for W and won't send any further messages until it is released.
We probably shouldn't be calling FlushPressedKeys here, but instead handling window resizing (and whatever else was cause the original bug that led to it being added) better. Need to investigate.
Note: Workaround is to override your player controller's FlushPressKeys and only call Super::FlushPressedKeys() if you didn't just switch the focus, but this may have knock ons if one of the events responsible for the UGameViewportClient::LostFocus bug occurs on the same frame.
See UDN for sample + extra repro details/bug explanation: https://udn.unrealengine.com/s/question/0D54z0000775mqsCAA/handling-character-movement-while-interacting-with-ui-in-gameandui-mode
Or from scratch in ThirdPersonExampleMap:
Map R key to an input action which:
Creates and adds a widget (just a button, doesn't really matter).
Call "Set User Focus" on the widget
PIE, press W to start moving forward, press R, continue holding W.
After 2 seconds your character stops moving forwards, and will not move forwards again until you release and repress W.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-125224 in the post.