From 5a90dd9312ed2568d1d7f4b2f728614c29ee0f85 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 12 Nov 2022 17:21:03 +0000 Subject: [PATCH] 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. --- emccpre.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emccpre.js b/emccpre.js index c4165bb..16833f5 100644 --- a/emccpre.js +++ b/emccpre.js @@ -448,9 +448,6 @@ function initPuzzle() { 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 @@ function initPuzzle() { 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(); }; }