Skip to content

Commit

Permalink
Fix dropdowns showing popup keyboard on mobile even when search bar i…
Browse files Browse the repository at this point in the history
…s initially hidden
  • Loading branch information
peppy committed Dec 18, 2023
1 parent ba569bf commit f949384
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions osu.Framework/Graphics/UserInterface/DropdownSearchBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Platform;
using osuTK;

namespace osu.Framework.Graphics.UserInterface
{
public abstract partial class DropdownSearchBar : VisibilityContainer
{
[Resolved]
private GameHost? host { get; set; }

private TextBox textBox = null!;
private PassThroughInputManager textBoxInputManager = null!;

Expand Down Expand Up @@ -68,6 +72,11 @@ protected override void LoadComplete()

public void ObtainFocus()
{
// On mobile platforms, let's not make the keyboard popup unless the dropdown is intentionally searchable.
bool willShowOverlappingKeyboard = host?.OnScreenKeyboardOverlapsGameWindow == true;
if (willShowOverlappingKeyboard && !AlwaysDisplayOnFocus)
return;

textBoxInputManager.ChangeFocus(textBox);
obtainedFocus = true;

Expand Down

0 comments on commit f949384

Please sign in to comment.