From 9c328059fe1b3445e32d5d4d7301ff732db658b0 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Wed, 16 Nov 2022 17:22:34 +0100 Subject: [PATCH] Input fixed (event path sometimes undefined on some browsers) --- PongGame/wwwroot/js/pong.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PongGame/wwwroot/js/pong.js b/PongGame/wwwroot/js/pong.js index 216e903..c8f387a 100644 --- a/PongGame/wwwroot/js/pong.js +++ b/PongGame/wwwroot/js/pong.js @@ -186,7 +186,7 @@ const keyEvent = (function () { } if (event.repeat) return; - if (event.path.indexOf(document.body) != 0) return; // only use key if it was pressed on empty space + if (event.target.tagName == 'INPUT') return; // dont use key if on input event.preventDefault(); moveUpdated();