Stats panel can open on top of another modal (missing scrim guard) #75
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
toggle_stats_screeninstats_plugin.rsdoes not check whether anotherModalScrimis already open before spawning the Stats panel.All other modal-spawning systems (Settings, Profile, Home, Achievements, Help, Leaderboard, Sync Setup) guard with:
toggle_stats_screenonly checksscreens.single()for its own screen — it does not check for other open modals. As a result, pressingS(or the Stats HUD button) while the Settings, Profile, Leaderboard, or any other modal is open will spawn a secondModalScrimon top of the existing one.Steps to reproduce
S(Stats keyboard shortcut)ModalScrimentities exist simultaneouslyFix
Add
other_modal_scrims: Query<(), (With<ModalScrim>, Without<StatsScreen>)>totoggle_stats_screenand return early if!other_modal_scrims.is_empty(), matching the pattern used by every other modal plugin.Fixed in commit
f1d9601Root cause
toggle_stats_screenonly checkedscreens.single()to see if the Stats panel itself was already open. It never checked whether another modal (Settings, Profile, Leaderboard, etc.) was already open. PressingSwhile any other modal was visible would spawn a secondModalScrim, violating the one-scrim-at-a-time invariant.Fix
Added
other_modal_scrims: Query<(), (With<ModalScrim>, Without<StatsScreen>)>as a system parameter and added an early-return guard:This matches the identical pattern already used by Settings, Profile, Home, Achievements, Help, Leaderboard, and Sync Setup. Also imported
ModalScrimwhich was missing from this file.Audit method: a Python script scanned all
spawn_modal()call sites across the codebase and verified each had a scrim guard within scope.stats_plugin.rswas the only production file that lacked it.