Clicking the "About" button (and "How to Play" button) resulted in a blank screen instead of showing the changelog/help overlay.
The changelog and help overlays are children of #gameContainer, which has display: none by default (set in CSS). When clicking "About" or "How to Play":
- Home screen was hidden
- Changelog/Help overlay had
hiddenclass removed - BUT
#gameContainerremaineddisplay: none - Result: Blank screen (overlay exists but parent is hidden)
#gameContainer (display: none initially)
├── #gameCanvas
├── #hudOverlay
├── #helpOverlay ← Child of gameContainer
├── #changelogOverlay ← Child of gameContainer
└── other game elements
Implemented a three-part fix:
Added viewingOverlayFromHome flag to Game class to track when user is viewing overlays from home screen (before game starts).
// In constructor
this.viewingOverlayFromHome = false;Updated both button handlers to:
- Set the tracking flag
- Show the game container (so overlays become visible)
- Show the overlay
// How to Play button
this.viewingOverlayFromHome = true;
gameContainer.style.display = 'block'; // ← Key fix
helpOverlay.classList.remove('hidden');
// About button
this.viewingOverlayFromHome = true;
gameContainer.style.display = 'block'; // ← Key fix
changelogOverlay.classList.remove('hidden');Updated checkAndShowHomeScreen() to:
- Check if viewing from home (
viewingOverlayFromHomeflag) - When overlays close, hide game container
- Show home screen
- Reset the flag
if (window.game && window.game.viewingOverlayFromHome) {
if (!this.helpVisible && !this.changelogVisible) {
gameContainer.style.display = 'none'; // Hide container
homeScreen.classList.remove('hidden'); // Show home
window.game.viewingOverlayFromHome = false; // Reset flag
}
}Home Screen
↓ Click "About"
↓ Home screen hidden
↓ Changelog overlay shown (but invisible)
↓ Game container still display: none
↓ RESULT: Blank screen ❌
Home Screen
↓ Click "About"
↓ Set viewingOverlayFromHome = true
↓ Home screen hidden
↓ Game container shown (display: block)
↓ Changelog overlay shown
↓ RESULT: Changelog visible ✅
↓ Press C to close
↓ Game container hidden (display: none)
↓ Home screen shown
↓ viewingOverlayFromHome = false
- Added tracking flag in constructor:
this.viewingOverlayFromHome = false;- Updated "How to Play" button:
this.viewingOverlayFromHome = true;
gameContainer.style.display = 'block';- Updated "About" button:
this.viewingOverlayFromHome = true;
gameContainer.style.display = 'block';Updated checkAndShowHomeScreen() method:
- Added check for
viewingOverlayFromHomeflag - Hide game container when returning to home from overlay
- Reset flag after returning to home
- Preserve original logic for in-game overlay viewing
✅ Show overlay → Close overlay → Return to home
✅ Show overlay → Close overlay → Return to paused game
✅ Home → Difficulty → Game (normal flow)
✅ Only return to home when ALL overlays are closed
✅ Click "About" from home → Changelog appears ✅ Press C to close → Returns to home screen ✅ Click "How to Play" from home → Help appears ✅ Press H to close → Returns to home screen ✅ Click "Start Mission" → Difficulty selection appears (unchanged) ✅ Open Help during game → Shows help ✅ Close Help during game → Returns to game ✅ No blank screens ✅ No console errors
Why this approach works:
viewingOverlayFromHomeflag distinguishes between:- Viewing overlay before game starts (from home)
- Viewing overlay during gameplay
- Game container visibility is controlled separately from game state
- Clean separation of concerns: navigation vs game state
Why previous approach failed:
- Assumed game container visibility = game running
- Didn't account for overlays needing visible container
- No way to differentiate pre-game vs in-game overlay viewing
✅ "About" button now shows the changelog properly ✅ "How to Play" button now shows help properly ✅ Both return to home screen when closed ✅ Game flow remains unchanged ✅ Professional user experience restored