ref: 5a90dd9312ed2568d1d7f4b2f728614c29ee0f85
parent: 8ef28a4fd6b3b111b3d2c0446d9d82784d239d22
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sat Nov 12 12:21:03 EST 2022
js: Give keyboard focus to the puzzle canvas at startup again I think this has been broken since a752e73, when the canvas changed to being hidden, and hence unable to receive keyboard focus, when the page loaded. I've now moved the focus() call to after the canvas gets displayed.
--- a/emccpre.js
+++ b/emccpre.js
@@ -448,9 +448,6 @@
permalink_desc = document.getElementById("permalink-desc");
permalink_seed = document.getElementById("permalink-seed");
- // Default to giving keyboard focus to the puzzle.
- onscreen_canvas.focus();
-
// Create the resize handle.
var resize_handle = document.createElement("canvas");
resize_handle.width = 10;
@@ -575,5 +572,8 @@
var apology = document.getElementById("apology");
if (apology !== null) apology.style.display = "none";
document.getElementById("puzzle").style.display = "";
+
+ // Default to giving keyboard focus to the puzzle.
+ onscreen_canvas.focus();
};
}