Bug Description
When the browser window loses focus during gameplay (e.g., alt-tabbing to another app) and then regains focus, all keyboard input stops being registered by the game. The player can see the game running but typing does nothing — no characters appear in the input field and no pests are defeated.
Steps to Reproduce
- Start the game on any stage
- While actively playing, press Alt+Tab to switch to another application
- Wait 2-3 seconds
- Alt+Tab back to the browser
- Try typing any word
Expected Behavior
Keyboard input should work normally immediately after the window regains focus. The game should re-attach or maintain its keydown event listeners regardless of focus changes.
Actual Behavior
Typing produces no response. The game loop appears to continue (pests still move) but the input field no longer captures keystrokes. The only fix is refreshing the page, which loses all progress.
Root Cause (suspected)
The keydown event listener may be attached to a DOM element that loses focus when the window is blurred. Instead of attaching to a specific element, the listener should be on window or document level to persist across focus changes.
Environment
- Chrome 122 / Firefox 124
- Windows 10 / macOS
- Reproducible 100% of the time
Wallet: 0x964739472C587d24934c37BEbB405CeE36D59B24
Bug Description
When the browser window loses focus during gameplay (e.g., alt-tabbing to another app) and then regains focus, all keyboard input stops being registered by the game. The player can see the game running but typing does nothing — no characters appear in the input field and no pests are defeated.
Steps to Reproduce
Expected Behavior
Keyboard input should work normally immediately after the window regains focus. The game should re-attach or maintain its keydown event listeners regardless of focus changes.
Actual Behavior
Typing produces no response. The game loop appears to continue (pests still move) but the input field no longer captures keystrokes. The only fix is refreshing the page, which loses all progress.
Root Cause (suspected)
The keydown event listener may be attached to a DOM element that loses focus when the window is blurred. Instead of attaching to a specific element, the listener should be on
windowordocumentlevel to persist across focus changes.Environment
Wallet: 0x964739472C587d24934c37BEbB405CeE36D59B24