Leaderboard panel missing modal scrim guard #77

Closed
opened 2026-05-28 22:52:35 +00:00 by funman300 · 1 comment
Owner

Bug

toggle_leaderboard_screen in leaderboard_plugin.rs is missing the other_modal_scrims guard that every other panel has. Pressing L (or clicking the leaderboard HUD button) while any other modal is open (Settings, Stats, Profile, etc.) spawns a second ModalScrim on top of the existing one.

This violates the constraint in CLAUDE.md §14.2:

Before spawning a new modal, check scrims.is_empty() and return early.

Root cause

The function has these parameters:

screens: Query<Entity, With<LeaderboardScreen>>,
// missing: other_modal_scrims: Query<(), (With<ModalScrim>, Without<LeaderboardScreen>)>,

The early-return guard if !other_modal_scrims.is_empty() { return; } before spawn_leaderboard_screen(...) was never added.

Fix

Add other_modal_scrims query parameter and guard — same pattern as stats_plugin.rs (fixed in #75), settings_plugin.rs, help_plugin.rs, etc.

Labels

  • bug
  • engine
## Bug `toggle_leaderboard_screen` in `leaderboard_plugin.rs` is missing the `other_modal_scrims` guard that every other panel has. Pressing **L** (or clicking the leaderboard HUD button) while any other modal is open (Settings, Stats, Profile, etc.) spawns a second `ModalScrim` on top of the existing one. This violates the constraint in CLAUDE.md §14.2: > Before spawning a new modal, check `scrims.is_empty()` and return early. ## Root cause The function has these parameters: ```rust screens: Query<Entity, With<LeaderboardScreen>>, // missing: other_modal_scrims: Query<(), (With<ModalScrim>, Without<LeaderboardScreen>)>, ``` The early-return guard `if !other_modal_scrims.is_empty() { return; }` before `spawn_leaderboard_screen(...)` was never added. ## Fix Add `other_modal_scrims` query parameter and guard — same pattern as `stats_plugin.rs` (fixed in #75), `settings_plugin.rs`, `help_plugin.rs`, etc. ## Labels - bug - engine
Author
Owner

Fix applied — commit ccf280e

Root cause: toggle_leaderboard_screen lacked the other_modal_scrims query that prevents a second ModalScrim from stacking on top of an already-open panel.

Change made (solitaire_engine/src/leaderboard_plugin.rs):

// Added new query parameter:
other_modal_scrims: Query<(), (With<ModalScrim>, Without<LeaderboardScreen>)>,

// Added guard before spawn_leaderboard_screen(...):
if !other_modal_scrims.is_empty() {
    return;
}

This is the same pattern already present in every other panel toggle (Settings, Stats, Help, Profile, Achievements). The leaderboard was the only panel missing it.

Verified: all 1,401 tests pass, clippy clean.

## Fix applied — commit `ccf280e` **Root cause:** `toggle_leaderboard_screen` lacked the `other_modal_scrims` query that prevents a second `ModalScrim` from stacking on top of an already-open panel. **Change made** (`solitaire_engine/src/leaderboard_plugin.rs`): ```rust // Added new query parameter: other_modal_scrims: Query<(), (With<ModalScrim>, Without<LeaderboardScreen>)>, // Added guard before spawn_leaderboard_screen(...): if !other_modal_scrims.is_empty() { return; } ``` This is the same pattern already present in every other panel toggle (Settings, Stats, Help, Profile, Achievements). The leaderboard was the only panel missing it. **Verified:** all 1,401 tests pass, clippy clean.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#77