Skip to content

Fix game screen stacking under wizard on Start - #15

Merged
yottanami merged 1 commit into
mainfrom
agent/172-screen-stacking-on-start
Aug 19, 2026
Merged

yottanami merged 1 commit into
mainfrom
agent/172-screen-stacking-on-start

Conversation

@yottanami

Copy link
Copy Markdown
Owner

What

startGame() toggled setupScreen/gameScreen/endScreen's .active class by hand instead of routing through the existing showScreen() helper (the pattern used everywhere else in the file). That manual toggle only ever cleared setupScreen (the wizard's step-1 screen) -- it never touched setupStep2Screen or setupStep3Screen, so whichever wizard step the player actually clicked Start Game from stayed .active and rendered stacked underneath gameScreen.

Fix: replace the 3-line manual toggle with showScreen('gameScreen'), which clears .active from every .screen element before activating the target. Also removed the now-dead setupScreen/gameScreen/endScreen local variable declarations in startGame() that only existed to feed the manual toggle.

endGame()'s own manual gameScreen/endScreen toggle was left as-is -- it's a 2-screen swap with no wizard screens in play at that point in the flow (a wizard screen would already have been cleared by startGame()'s fix by the time endGame() can run), so it isn't part of this bug and isn't in the issue's scope.

Testing

  • npx tsc --noEmit -- clean.
  • npx vitest run -- 172/172 tests pass (no existing test exercised this DOM path).
  • npm run build -- clean.
  • Real headless-Chromium click-through (nix-built chromium + puppeteer-core, stubbed navigator.requestMIDIAccess since headless has no real MIDI device/permission prompt to answer) driving the actual wizard: Start -> step 1 -> step 2 -> step 3 -> Start Game.
    • Before the fix (confirmed by stashing the change and re-running): after clicking Start Game from step 3, active screens were ['setupStep3Screen', 'gameScreen'] -- reproduces the reported stacking bug exactly.
    • After the fix: active screens are ['gameScreen'] only.

Closes Men-in-Black-5/ideas#172

startGame() toggled setupScreen/gameScreen/endScreen's .active class by
hand instead of going through showScreen(), so it never cleared
setupStep2Screen or setupStep3Screen -- whichever wizard step the
player clicked Start from stayed .active underneath gameScreen.

Closes Men-in-Black-5/ideas#172
@yottanami

Copy link
Copy Markdown
Owner Author

reviewer: approved. Confirmed showScreen() clears .active from every .screen element via querySelectorAll, not a hardcoded subset -- so this genuinely closes the whole bug class as the PR claims, not just this one call site. Grepped the rest of startGame() for the removed local vars -- no lingering references, clean removal. endGame()'s separate toggle is correctly untouched: by the time it can run, no wizard screen can still be active. Real before/after Chromium evidence (stashed the fix to reproduce [setupStep3Screen, gameScreen] stacked, confirmed [gameScreen] only after) is exactly the right verification for a DOM-state bug like this. CI green, no stacked-PR conflicts. Merging (squash).

@yottanami
yottanami merged commit e8c6995 into main Aug 19, 2026
2 checks passed
@yottanami
yottanami deleted the agent/172-screen-stacking-on-start branch August 19, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant