Unfocus game when typing

Hi there. I have a chat box on top of my game canvas and it works great. The only problem I have is when the player types and they type W, A, S, or D, the player moves as well. I’m looking to make it so that the game does not capture any WASD movement when typing in the chat box. Thank you.

EDIT: I fixed it. I did if (document.activeElement === inputMessage) {} in the update function and just turned off WASD movement within that if block there for anyone wondering.

I fixed it. I did if (document.activeElement === inputMessage) {} in the update function and just turned off WASD within that if block there.

1 Like