From 0c7a844b4b24eefb00e2e1e49f807c6f3b845ab9 Mon Sep 17 00:00:00 2001
From: Berkay Girgin <28847330+Gerile3@users.noreply.github.com>
Date: Thu, 12 Sep 2024 10:05:29 +0300
Subject: [PATCH] add focusing for mobile support
---
index.html | 50 +++++++++++++++++++++++++-------------------------
script.js | 6 ++++++
2 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/index.html b/index.html
index 189be35..c2119e5 100644
--- a/index.html
+++ b/index.html
@@ -17,43 +17,43 @@
Word Master
diff --git a/script.js b/script.js
index 5178161..4ae38d0 100644
--- a/script.js
+++ b/script.js
@@ -181,6 +181,7 @@ document.addEventListener("keyup", (event) => {
inputs[currentIndex].value = event.key.toUpperCase();
if ((currentIndex + 1) % 5 !== 0 && currentIndex < 25){
currentIndex++;
+ inputs[currentIndex].focus(); // Move focus to the next input
}
}
@@ -189,6 +190,7 @@ document.addEventListener("keyup", (event) => {
inputs[currentIndex].value = "";
} else if (currentIndex > minIndex) {
currentIndex--;
+ inputs[currentIndex].focus();
inputs[currentIndex].value = "";
}
}
@@ -202,3 +204,7 @@ window.addEventListener("load", () => {
loadcomplete(false)
});
+inputs.forEach(input => {
+ input.readOnly = true; // Keeps the input focusable but prevents editing
+});
+