keydown event not firing in google sites/wix when using easel.js

30 views Asked by At

I'm trying to understand why my 15-puzzle game works locally but not when embedded in a google site or a wix site.

Here's a sample of the code:

<canvas id = "myCanvas" width = "800" height = "700"></canvas>
<script src="https://code.createjs.com/1.0.0/easeljs.min.js"></script>
<script>

let canvas = document.getElementById("myCanvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let stage = new createjs.Stage(canvas);
window.onkeydown = function(e){
    console.log(e.key)
};
</script>

There is nothing logged on the console when opening it on google sites.

What have I tried so far: (1) running locally: this code works properly and I can see the key get logged in the console (2) embedding my code in a wix and a sites.google.com site. Example (nothing is logged and the player cannot move): https://sites.google.com/view/manyminigames/easel-test?authuser=0 (3) omitting the "let stage = new createjs.Stage(canvas);" on wix/google will show the keydown in the console. (4) Changing canvas size will sometimes make it work depending on if it is small enough. I want the canvas covering the full screen though.

0

There are 0 answers