Merge pull request #24375 from peppy/add-back-mode-select-enter-close

Add back the ability to close mod select using enter key
This commit is contained in:
Bartłomiej Dach 2023-07-26 22:43:38 +02:00 committed by GitHub
commit 057bac39dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -542,7 +542,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("clear search", () => modSelectOverlay.SearchTerm = string.Empty);
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddAssert("mod select still visible", () => modSelectOverlay.State.Value == Visibility.Visible);
AddAssert("mod select hidden", () => modSelectOverlay.State.Value == Visibility.Hidden);
}
[Test]

View File

@ -638,8 +638,12 @@ namespace osu.Game.Overlays.Mods
case GlobalAction.Select:
{
// Pressing select should select first filtered mod if a search is in progress.
// If there is no search in progress, it should exit the dialog (a bit weird, but this is the expectation from stable).
if (string.IsNullOrEmpty(SearchTerm))
{
hideOverlay(true);
return true;
}
ModState? firstMod = columnFlow.Columns.OfType<ModColumn>().FirstOrDefault(m => m.IsPresent)?.AvailableMods.FirstOrDefault(x => x.Visible);