Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
dfb2e77
1
Parent(s):
9d14994
- static/index.html +13 -0
static/index.html
CHANGED
|
@@ -574,7 +574,16 @@
|
|
| 574 |
});
|
| 575 |
|
| 576 |
// Track keyboard events
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
document.addEventListener("keydown", function (event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
if (!isConnected || isProcessing) return;
|
| 579 |
|
| 580 |
// Get the current mouse position
|
|
@@ -586,6 +595,10 @@
|
|
| 586 |
});
|
| 587 |
|
| 588 |
document.addEventListener("keyup", function (event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
if (!isConnected || socket.readyState !== WebSocket.OPEN) return;
|
| 590 |
|
| 591 |
// Get the current mouse position
|
|
|
|
| 574 |
});
|
| 575 |
|
| 576 |
// Track keyboard events
|
| 577 |
+
const TROUBLESOME = new Set([
|
| 578 |
+
"Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Space"
|
| 579 |
+
]);
|
| 580 |
+
|
| 581 |
document.addEventListener("keydown", function (event) {
|
| 582 |
+
// Prevent the browser from moving focus when Tab is pressed so it is sent to the backend instead
|
| 583 |
+
if (TROUBLESOME.has(event.key)) {
|
| 584 |
+
event.preventDefault();
|
| 585 |
+
event.stopPropagation();
|
| 586 |
+
}
|
| 587 |
if (!isConnected || isProcessing) return;
|
| 588 |
|
| 589 |
// Get the current mouse position
|
|
|
|
| 595 |
});
|
| 596 |
|
| 597 |
document.addEventListener("keyup", function (event) {
|
| 598 |
+
if (TROUBLESOME.has(event.key)) {
|
| 599 |
+
event.preventDefault();
|
| 600 |
+
event.stopPropagation();
|
| 601 |
+
}
|
| 602 |
if (!isConnected || socket.readyState !== WebSocket.OPEN) return;
|
| 603 |
|
| 604 |
// Get the current mouse position
|