I'm having an issue with the HTML5 <canvas>
element in Firefox 2.0.0.16 and Safari 3.1.2 on my iMac. Even testing in Firefox 3.0 on Windows did not resolve the problem. Here is the code snippet that seems to be causing the trouble:
<td>
<canvas id="display"
width="500px"
height="500px">
</canvas>
</td>
When I click a button to activate some functionality that interacts with the canvas, the onclick()
event calls a function with the following line of code:
document.getElementById("display").focus();
Despite no errors reported by Firebug, the focus does not change to the canvas. Clicking on the canvas or tabbing towards it does not trigger the canvas's onfocus()
event either. This behavior seems strange to me. Is there a reason the canvas cannot receive focus, or is there a mistake in my approach? Any insights would be greatly appreciated.
Thank you.