Skip to content

Commit acddbf2

Browse files
committed
Add visuals for keyboard
1 parent 25c41dd commit acddbf2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

script.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,12 @@ window.addEventListener("keydown", (e) => {
179179

180180
keys.forEach((key) => {
181181
if (keyboardKey === key.value) {
182-
key.focus();
182+
key.classList.add("active");
183183
key.click();
184184
}
185185
});
186186
});
187+
188+
window.addEventListener("keyup", (e) => {
189+
keys.forEach(key => key.classList.remove("active"));
190+
});

style.css

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ input[type="button"]:active {
4848
background-color: rgb(var(--rgb), 0.5);
4949
}
5050

51+
input[type="button"].active {
52+
background-color: rgb(var(--rgb), 0.5);
53+
}
54+
5155
input[type="text"] {
5256
background-color: #ded4e8;
5357
height: 90px;

0 commit comments

Comments
 (0)