dkl9 commited on 2025-361 17:44:49
Showing 1 changed files, with 12 additions and 0 deletions.
| ... | ... |
@@ -58,6 +58,11 @@ function shakeRow(row) {
|
| 58 | 58 |
row.classList.add("shake");
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 |
+function inputting() {
|
|
| 62 |
+ const focus = document.activeElement.tagName.toLowerCase(); |
|
| 63 |
+ return focus == "textarea" || focus == "input"; |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 61 | 66 |
for (let i = 0; i < maxGuesses; i++) {
|
| 62 | 67 |
const tr = document.createElement("tr");
|
| 63 | 68 |
for (let j = 0; j < tl; j++) {
|
| ... | ... |
@@ -70,6 +75,13 @@ for (let i = 0; i < maxGuesses; i++) {
|
| 70 | 75 |
let currentRow = 0; |
| 71 | 76 |
let currentInput = []; |
| 72 | 77 |
|
| 78 |
+// https://stackoverflow.com/a/8563788 for a quirk of Firefox |
|
| 79 |
+document.addEventListener("keydown", e => {
|
|
| 80 |
+ if (!inputting() && e.key == "/") {
|
|
| 81 |
+ e.preventDefault(); |
|
| 82 |
+ } |
|
| 83 |
+}); |
|
| 84 |
+ |
|
| 73 | 85 |
document.addEventListener("keyup", e => {
|
| 74 | 86 |
const row = grid.rows[currentRow]; |
| 75 | 87 |
if (e.key === "Backspace") {
|
| 76 | 88 |