-
Notifications
You must be signed in to change notification settings - Fork 788
fix(droid): hide keyboard when onfocused #20692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(droid): hide keyboard when onfocused #20692
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refines keyboard hiding behavior on Android by checking if the next focused element requires text input before calling HideTextInput
.
- Extends the condition to include multiple input controls (TextBox, AutoSuggestBox, NumberBox).
- Introduces
IsFocusingElementKeyboardActivator
andCouldRequireKeyboard
helper methods. - Updates comments to clarify new logic and prevent keyboard flicker.
Comments suppressed due to low confidence (2)
src/Uno.UI.Runtime.Skia.Android/AndroidSkiaTextBoxNotificationsProviderSingleton.cs:39
- The method name
IsFocusingElementKeyboardActivator
is misleading, as it returns true when the next element does not require the keyboard. Consider renaming it toShouldHideKeyboard
orIsNextElementNotKeyboardInput
for clarity.
if (IsFocusingElementKeyboardActivator(textBox.XamlRoot))
src/Uno.UI.Runtime.Skia.Android/AndroidSkiaTextBoxNotificationsProviderSingleton.cs:39
- This new branching logic for hiding the keyboard should be covered by unit or integration tests to verify that
HideTextInput
is only called when appropriate (e.g., when focusing away from and to an input control).
if (IsFocusingElementKeyboardActivator(textBox.XamlRoot))
{ | ||
canvasView.TextInputPlugin.HideTextInput(); | ||
} | ||
|
||
canvasView.TextInputPlugin.NotifyViewExited(textBox.GetHashCode()); | ||
} | ||
|
||
static bool IsFocusingElementKeyboardActivator(XamlRoot? xamlRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CouldRequireKeyboard
method uses a hardcoded list of control types and will need updates whenever new text-input controls are introduced. Consider defining an interface or attribute for keyboard-activating controls to make this more extensible.
Copilot uses AI. Check for mistakes.
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20692/wasm-skia-net9/index.html |
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20692/docs/index.html |
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20692/docs/index.html |
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20692/wasm-skia-net9/index.html |
|
e602b65
to
2437c8e
Compare
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20692/wasm-skia-net9/index.html |
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20692/docs/index.html |
GitHub Issue: closes #20564
PR Type:
What is the current behavior? π€
What is the new behavior? π
PR Checklist β
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information βΉοΈ