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) {
|
if (canvas) {
|
||||||
canvas.classList.add('game-active');
|
canvas.classList.add('game-active');
|
||||||
canvas.style.visibility = 'visible';
|
canvas.style.visibility = 'visible';
|
||||||
|
canvas.focus(); // Canvas fokussieren für Tastatureingaben
|
||||||
}
|
}
|
||||||
// No overlays shown during gameplay
|
// No overlays shown during gameplay
|
||||||
break;
|
break;
|
||||||
@@ -222,6 +223,13 @@ window.onWasmReady = function() {
|
|||||||
console.log('✅ WASM fully initialized');
|
console.log('✅ WASM fully initialized');
|
||||||
wasmReady = true;
|
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
|
// Switch to menu state
|
||||||
setUIState(UIState.MENU);
|
setUIState(UIState.MENU);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user