From 51f4c7254c80bca74ea0ae9e772c630feb7f6a4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Dec 2023 01:32:30 +0900 Subject: [PATCH] Fix mod search textbox having focus while settings are visible Stopped arrow key adjust on slider bars from working. Also just felt wrong that you could type into an off-screen textbox. --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 13 ++++++++----- osu.Game/Overlays/Mods/ModSettingsArea.cs | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index ce798ae752..30d7b6191e 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -508,6 +508,11 @@ namespace osu.Game.Overlays.Mods modSettingsArea.ResizeHeightTo(modAreaHeight, transition_duration, Easing.InOutCubic); TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic); + + if (customisationVisible.Value) + GetContainingInputManager().ChangeFocus(modSettingsArea); + else + Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); } /// @@ -622,7 +627,7 @@ namespace osu.Game.Overlays.Mods } if (textSearchStartsActive.Value) - SearchTextBox.TakeFocus(); + SearchTextBox.HoldFocus = true; } protected override void PopOut() @@ -761,11 +766,9 @@ namespace osu.Game.Overlays.Mods return false; // TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`) - if (SearchTextBox.HasFocus) - SearchTextBox.KillFocus(); - else + SearchTextBox.HoldFocus = !SearchTextBox.HoldFocus; + if (SearchTextBox.HoldFocus) SearchTextBox.TakeFocus(); - return true; } diff --git a/osu.Game/Overlays/Mods/ModSettingsArea.cs b/osu.Game/Overlays/Mods/ModSettingsArea.cs index 6158c2c70f..54bfcc7199 100644 --- a/osu.Game/Overlays/Mods/ModSettingsArea.cs +++ b/osu.Game/Overlays/Mods/ModSettingsArea.cs @@ -32,6 +32,8 @@ namespace osu.Game.Overlays.Mods [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; + public override bool AcceptsFocus => true; + public ModSettingsArea() { RelativeSizeAxes = Axes.X;