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:
+2
-1
@@ -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;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user