fix: prevent button focus from interfering with game controls when changing modes

- Add blur() to mode buttons to remove focus after clicking
- Add preventDefault() to space/escape handlers to stop button activation
- Fix stale closures in useKeyBindings by accessing gameManager directly
- Remove all useCallback hooks per React 19 best practices
- Remove function dependencies from useEffect hooks
This commit is contained in:
2025-11-04 00:09:24 +00:00
parent 308eafac62
commit 2795931d56
6 changed files with 77 additions and 66 deletions
+2 -1
View File
@@ -43,7 +43,7 @@ export type FallingLetter = {
export type KeyLogEntry = { key: string; timestamp: number };
export type GameOptions = {
gameMode?: GameMode;
initialGameMode?: GameMode;
};
// ============================================================================
@@ -153,6 +153,7 @@ export type GameManager = {
// Game-specific
handleTypedLetter: (letter: string) => void;
changeGameMode: (mode: GameMode) => void;
};
// ============================================================================