fix(engine): close Settings, Help, Leaderboard, and theme store on Esc
Test / test (pull_request) Successful in 10m16s
Test / test (pull_request) Successful in 10m16s
Phase C dismissal audit: Esc / scrim-tap / Done must behave the same on every modal. Stragglers found and fixed — none of these had any Esc path (pause's toggle guard swallowed the key while they were open): - Settings: Esc clears SettingsScreen, gated on being the topmost modal so a stacked sync-setup / theme-store dialog owns Esc - Help: Esc closes alongside F1/Done (the code comment already claimed an Esc path existed — now it does) - Leaderboard: Esc closes when topmost; the display-name dialog stacked above it now Esc-cancels like sync-setup's dialog - Theme store: Esc closes (always topmost when open) Scrim-tap opt-ins are unchanged — ui_modal documents which modals deliberately stay non-dismissible on outside clicks. Tests: escape_closes_help_screen, escape_closes_settings_screen_flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,15 +50,21 @@ pub(super) fn handle_volume_keys(
|
||||
}
|
||||
|
||||
/// Opens or closes the Settings panel — `O` keyboard accelerator or
|
||||
/// `ToggleSettingsRequestEvent` from the HUD Menu popover.
|
||||
/// `ToggleSettingsRequestEvent` from the HUD Menu popover. Esc closes
|
||||
/// too (Phase C dismissal audit), but only when Settings is the
|
||||
/// topmost modal — with sync-setup or the theme store stacked on top,
|
||||
/// the stacked dialog owns Esc.
|
||||
pub(super) fn toggle_settings_screen(
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
mut requests: MessageReader<ToggleSettingsRequestEvent>,
|
||||
mut screen: ResMut<SettingsScreen>,
|
||||
other_modal_scrims: Query<(), (With<ModalScrim>, Without<SettingsPanel>)>,
|
||||
) {
|
||||
let button_clicked = requests.read().count() > 0;
|
||||
if keys.just_pressed(KeyCode::KeyO) || button_clicked {
|
||||
screen.0 = !screen.0;
|
||||
} else if keys.just_pressed(KeyCode::Escape) && screen.0 && other_modal_scrims.is_empty() {
|
||||
screen.0 = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user