diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs index a3dab1f478..c1d247b409 100644 --- a/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs +++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs @@ -735,7 +735,7 @@ public void TestPaddedSearchBar() } [Test] - public void TestDoubleClickOnHeader() + public void TestDoubleClickOnHeader([Values] bool alwaysShowSearchBar) { TestDropdown testDropdown = null!; bool wasOpened = false; @@ -747,6 +747,8 @@ public void TestDoubleClickOnHeader() wasClosed = false; testDropdown = createDropdown(); + testDropdown.AlwaysShowSearchBar = alwaysShowSearchBar; + testDropdown.Menu.StateChanged += s => { wasOpened |= s == MenuState.Open; diff --git a/osu.Framework/Graphics/UserInterface/DropdownHeader.cs b/osu.Framework/Graphics/UserInterface/DropdownHeader.cs index 2cf59c3cc9..433a0e349e 100644 --- a/osu.Framework/Graphics/UserInterface/DropdownHeader.cs +++ b/osu.Framework/Graphics/UserInterface/DropdownHeader.cs @@ -139,8 +139,8 @@ private void updateState() /// private bool onClick(ClickEvent e) { - // Allow input to fall through to the search bar (and its contained textbox) if it's visible. - if (SearchBar.State.Value == Visibility.Visible) + // Allow input to fall through to the search bar (and its contained textbox) if there's any search text. + if (SearchBar.State.Value == Visibility.Visible && !string.IsNullOrEmpty(SearchTerm.Value)) return false; // Otherwise, the header acts as a button to show/hide the menu. diff --git a/osu.Framework/Graphics/UserInterface/DropdownSearchBar.cs b/osu.Framework/Graphics/UserInterface/DropdownSearchBar.cs index b3950bf345..c0879d6ac5 100644 --- a/osu.Framework/Graphics/UserInterface/DropdownSearchBar.cs +++ b/osu.Framework/Graphics/UserInterface/DropdownSearchBar.cs @@ -150,6 +150,8 @@ private void onMenuStateChanged(MenuState state) } else dropdown.ChangeFocus(textBox); + + updateTextBoxVisibility(); } ///