Enable canvas focus for keyboard input by setting tabindex and automatically focusing during gameplay.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m1s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m1s
This commit is contained in:
@@ -73,6 +73,7 @@ function setUIState(newState) {
|
||||
if (canvas) {
|
||||
canvas.classList.add('game-active');
|
||||
canvas.style.visibility = 'visible';
|
||||
canvas.focus(); // Canvas fokussieren für Tastatureingaben
|
||||
}
|
||||
// No overlays shown during gameplay
|
||||
break;
|
||||
@@ -222,6 +223,13 @@ window.onWasmReady = function() {
|
||||
console.log('✅ WASM fully initialized');
|
||||
wasmReady = true;
|
||||
|
||||
// Canvas fokussierbar machen
|
||||
const canvas = document.querySelector('canvas');
|
||||
if (canvas) {
|
||||
canvas.setAttribute('tabindex', '1');
|
||||
console.log('✅ Canvas tabindex gesetzt');
|
||||
}
|
||||
|
||||
// Switch to menu state
|
||||
setUIState(UIState.MENU);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user