diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs
index bf47e4351a..7c0ed941c6 100644
--- a/osu.Game/Overlays/Mods/ModSelectScreen.cs
+++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs
@@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Mods;
+using osu.Game.Screens.Select;
using osuTK;
using osuTK.Input;
@@ -44,6 +45,15 @@ namespace osu.Game.Overlays.Mods
}
}
+ ///
+ /// Hotkey that should be used to hide the mod select screen.
+ ///
+ ///
+ /// This is handled locally here rather than via , because this overlay is being registered at the game level
+ /// and therefore takes away keyboard focus from the screen stack.
+ ///
+ internal GlobalAction? Hotkey { get; set; }
+
///
/// Whether configurable s can be configured by the local user.
///
@@ -321,12 +331,23 @@ namespace osu.Game.Overlays.Mods
public override bool OnPressed(KeyBindingPressEvent e)
{
+ if (e.Repeat)
+ return false;
+
if (e.Action == GlobalAction.Back && customisationVisible.Value)
{
customisationVisible.Value = false;
return true;
}
+ if (e.Action == Hotkey)
+ {
+ if (customisationVisible.Value)
+ customisationVisible.Value = false;
+ Hide();
+ return true;
+ }
+
return base.OnPressed(e);
}
diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs
index c4503773ad..4b6c06481b 100644
--- a/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs
+++ b/osu.Game/Screens/OnlinePlay/OnlinePlaySongSelect.cs
@@ -12,6 +12,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
+using osu.Game.Input.Bindings;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
@@ -162,6 +163,7 @@ namespace osu.Game.Screens.OnlinePlay
protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum)
{
+ Hotkey = GlobalAction.ToggleModSelection,
IsValidMod = IsValidMod
};
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index eb5e996972..7317b20f88 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -333,7 +333,10 @@ namespace osu.Game.Screens.Select
(new FooterButtonOptions(), BeatmapOptions)
};
- protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen();
+ protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen
+ {
+ Hotkey = GlobalAction.ToggleModSelection
+ };
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
{