Click event not fired when clicking on canvas in Chrome during animation (works in Firefox)

My janky flying rat game

Working on this janky little flying rat game.

I’m planning on having the rat shoot cheese bullets in the direction of the mouse pointer. I am adding click event listeners – currently on window, but will be on canvas afterwards.

The click event currently prints the mouse position to console

When I open the game, the click event fires and prints to console regardless of where I click.

Once the canvas switches from the introduction “page” to the actual game, the click event stops firing when clicking on the canvas – yet it keeps firing click events outside of the canvas.

This issue happens in Chrome. In Firefox there is no issue.

I also noticed that when looking at elements in chrome dev tools, once the introduction page ends, and the game starts, the body block (in “elements section”) starts flickering. I’m thinking this may be related.

I can’t see what is so different about how the introduction page canvas and the gameplay are animated/drawn to cause this issue.