mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:17:27 +08:00
Merge pull request #27780 from mafarrica/27105-fix-mod-search-box-focus-changes
Fix mod search box not tracking external changes to focus state
This commit is contained in:
commit
1344ca4e19
@ -612,6 +612,23 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSearchBoxFocusToggleRespondsToExternalChanges()
|
||||||
|
{
|
||||||
|
AddStep("text search does not start active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false));
|
||||||
|
createScreen();
|
||||||
|
|
||||||
|
AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
|
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
|
AddStep("unfocus search text box externally", () => InputManager.ChangeFocus(null));
|
||||||
|
|
||||||
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
|
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions()
|
public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions()
|
||||||
{
|
{
|
||||||
|
@ -143,8 +143,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
protected ShearedToggleButton? CustomisationButton { get; private set; }
|
protected ShearedToggleButton? CustomisationButton { get; private set; }
|
||||||
protected SelectAllModsButton? SelectAllModsButton { get; set; }
|
protected SelectAllModsButton? SelectAllModsButton { get; set; }
|
||||||
|
|
||||||
private bool textBoxShouldFocus;
|
|
||||||
|
|
||||||
private Sample? columnAppearSample;
|
private Sample? columnAppearSample;
|
||||||
|
|
||||||
private WorkingBeatmap? beatmap;
|
private WorkingBeatmap? beatmap;
|
||||||
@ -542,7 +540,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (customisationVisible.Value)
|
if (customisationVisible.Value)
|
||||||
SearchTextBox.KillFocus();
|
SearchTextBox.KillFocus();
|
||||||
else
|
else
|
||||||
setTextBoxFocus(textBoxShouldFocus);
|
setTextBoxFocus(textSearchStartsActive.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -798,15 +796,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
|
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
|
||||||
setTextBoxFocus(!textBoxShouldFocus);
|
setTextBoxFocus(!SearchTextBox.HasFocus);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTextBoxFocus(bool keepFocus)
|
private void setTextBoxFocus(bool focus)
|
||||||
{
|
{
|
||||||
textBoxShouldFocus = keepFocus;
|
if (focus)
|
||||||
|
|
||||||
if (textBoxShouldFocus)
|
|
||||||
SearchTextBox.TakeFocus();
|
SearchTextBox.TakeFocus();
|
||||||
else
|
else
|
||||||
SearchTextBox.KillFocus();
|
SearchTextBox.KillFocus();
|
||||||
|
Loading…
Reference in New Issue
Block a user