kumavis / node-warrior

:tiger: 3D multiplayer voxel sandbox to teach programming

Home Page:https://kumavis.github.io/node-warrior

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editor blur key propagation

knod opened this issue · comments

commented

Once focused in the code editor, pressing 'esc' twice will exit you to all the way out of the game to where your mouse is free of the game. You have to click on the screen to get back in.

commented

I think the problem may be that when the player presses 'esc' the second time, to escape the code editor all together, the element affected is the window which may mean that event propagation isn't the problem. I haven't been able to trace which element listens for 'esc' in order to release the player from the game, but maybe the window element is it, so pressing 'esc' on the window element will just always have that behavior.

Right now we're using the window element to listen for the esc key in order to exit the code editor. At the time this was presumably because we put focus on the window to remove focus from the code editor, here it looks like we actually managed to use .blur(), so is that really what happens?

If so we may be able to do something different to escape the editor on the second press so that it doesn't remove the player from the game, or perhaps we can just focus on a different element.