Needing to click twice on the HTML5 game canvas to make clicks register (DEF-3198) (SOLVED)

With testing Facebook Instant games a lot it’s obvious there is something wrong with the way Defold handles clicks / has focus. Other games can handle clicks instantly when clicking onto their canvas. Defold games do not, they require one click to make Defold begin to accept clicks, and then clicks after register. If you click off the canvas then the next click on the canvas also won’t work.

This makes games feel broken / unresponsive.

3 Likes

It looks like it’s in the glfw javascript code, it ignores mouse clicks until the canvas is active. Adding a ticket: DEF-3198

4 Likes

Awesome!

Here is a temporary patch for anyone releasing a Facebook Instant Game soon. Search the exported .js and replace the only document.activeElement==Module[“canvas”] with true

5 Likes

Solved in Defold 1.2.128

5 Likes