What engine are you using?
You're supposed to intercept keyboard events when your html canvas is in focus, but usually the engine takes care of that (I know Unity WebGL builds do).
i'm using construct 3
I don't know Construct 3, but I know I solved this problem in my own web engine earlier. I can look up the details tomorrow, maybe it's useful...