Merged
Conversation
smoogipoo
commented
May 17, 2024
Comment on lines
-75
to
-86
| // On mobile platforms, let's not make the keyboard popup unless the dropdown is intentionally searchable. | ||
| // Unfortunately it is not enough to just early-return here, | ||
| // as even despite that the text box will receive focus via the text box input manager; | ||
| // it is necessary to cut off the text box input manager from parent input entirely. | ||
| // TODO: preferably figure out a better way to do this. | ||
| bool willShowOverlappingKeyboard = host?.OnScreenKeyboardOverlapsGameWindow == true; | ||
|
|
||
| if (willShowOverlappingKeyboard && !AlwaysDisplayOnFocus) | ||
| { | ||
| textBoxInputManager.UseParentInput = false; | ||
| return; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
I haven't yet tested whether removing this is an issue (likely is). The logic here is quite convoluted.
Contributor
Author
There was a problem hiding this comment.
Fixed by 5724733. It's touching some scary code but I think it makes sense.
Member
|
I've added tests in my other PR to ensure the issues linked above are specifically fixed (see cf31661), worth adding in this PR. For ppy/osu#25850, I would just disable searching in |
Contributor
Author
|
@frenzibyte Thanks. Added your tests almost verbatim in the last commit. |
peppy
approved these changes
May 19, 2024
Member
|
Definitely better than the other approach, let's see how this pans out 😄 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes ppy/osu#25769
Fixes ppy/osu#26079 (likely)
Supersedes / closes #6095
Closes #6097 (note that ppy/osu#25850 is likely not fixed by this and will need reimplementation)
By extracting focus-management logic out of
InputManager, we can implement something akin to a focus trap. Components can trap the focus management (ChangeFocus()/TriggerFocusContention()) of their subcomponents to add supplementary logic.This PR features a partial redesign of
Dropdownmaking use of this. There are two components wanting to manage focus here - theMenuand theTextBox.Menu's focus is trapped byDropdownand reduced to a no-op.TextBox's focus is trapped withinDropdownSearchBoxto perform additional functionality such as opening the dropdown on focus, selecting items on commit, clearing text on escape, etc.This is not a breaking change, but I've obsoleted
InputManager.TriggerFocusContention()andInputManager.ChangeFocus()partially to make this easy to test.