[Bug] Entry looses focus #15870
Description
Description
I have the same problem as @APopatanasov in dotnet/maui#5916. I have an Entry
which looses focus when some other element on the page is tapped.
In MAUI this issue has been fixed in dotnet/maui#6246 two years ago. Unfortunately the code which causes the problem is still present in https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.Android/PlatformRenderer.cs
Is it possible to backport that from MAUI to XF or did you already cease to make any changes?
Steps to Reproduce
- Add an
Entry
and aLabel
withTapGestureRecognizer
(I didn't test with aButton
) to a page - I even set all Android Views but the Editors renderer to
Focusable=false;FocusableInTouchMode=false;
- focus the
Entry
and tap theLabel
Expected Behavior
The Entry
keeps its focus and the soft keyboard remains shown.
Actual Behavior
The PlatformRenderer
calls ClearFocus()
and thus the soft keyboard is hidden - although no other view has the focus. On the Android side at this point Activity.CurrentFocus
returns null
.
Basic Information
- Version with issue: 5.0.0.2622
- Platform Target Frameworks:
- Android: 13.0
Workaround
I did not find a workaround. If you know how I can prevent that without XF needing to change, I'm happy to use that.