chiark / gitweb /
IE doesn't default to giving focus to the puzzle canvas on a mouse
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Apr 2013 15:49:21 +0000 (15:49 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 5 Apr 2013 15:49:21 +0000 (15:49 +0000)
click, so manually implement that behaviour. (Without it, it's quite
hard to focus the canvas at all in IE.)

[originally from svn r9806]

emccpre.js

index 430aae4afdb65725bf645d13066b3b4cd7b0e31f..38d7815ae90bbb685712a72963a0dfe0ab28379d 100644 (file)
@@ -233,6 +233,12 @@ function initPuzzle() {
             command(2);
     };
 
+    // In IE, the canvas doesn't automatically gain focus on a mouse
+    // click, so make sure it does
+    onscreen_canvas.addEventListener("mousedown", function(event) {
+        onscreen_canvas.focus();
+    });
+
     // In our dialog boxes, Return and Escape should be like pressing
     // OK and Cancel respectively
     document.addEventListener("keydown", function(event) {