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.
This commit is contained in:
Ben Harris
2022-11-12 17:21:03 +00:00
parent 8ef28a4fd6
commit 5a90dd9312

View File

@ -448,9 +448,6 @@ function initPuzzle() {
permalink_desc = document.getElementById("permalink-desc"); permalink_desc = document.getElementById("permalink-desc");
permalink_seed = document.getElementById("permalink-seed"); permalink_seed = document.getElementById("permalink-seed");
// Default to giving keyboard focus to the puzzle.
onscreen_canvas.focus();
// Create the resize handle. // Create the resize handle.
var resize_handle = document.createElement("canvas"); var resize_handle = document.createElement("canvas");
resize_handle.width = 10; resize_handle.width = 10;
@ -575,5 +572,8 @@ function initPuzzle() {
var apology = document.getElementById("apology"); var apology = document.getElementById("apology");
if (apology !== null) apology.style.display = "none"; if (apology !== null) apology.style.display = "none";
document.getElementById("puzzle").style.display = ""; document.getElementById("puzzle").style.display = "";
// Default to giving keyboard focus to the puzzle.
onscreen_canvas.focus();
}; };
} }