Moving forward (W) key up and mouse left click

I use w keydown to move my character as usual and need to use mouse left click to fire bullet simultaneously. But the problem is after I click the mouse button then release W key, my character not stop walking which means W keyup was ignored. My aim is to fire and walk at the same time. I need to press the W key again to stop my character. Any clue for this?

I figured out the problem. That’s because I use the surface pro touch keyboard. Using the type cover keyboard instead solve the problem.