Additionally you also need something like this in the html part:
<canvas id="3darea" onclick="document.getElementById('3darea').focus();" width="800" height="600" style="background-color:#"#000000"">
</canvas>
Otherwise the canvas will lose focus, despite being clicked.