Bug 22984 - [Android only, certain soft keyboards] EntryCell loses focus while typing
Summary: [Android only, certain soft keyboards] EntryCell loses focus while typing
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC All
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-15 02:56 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2017-02-02 04:20 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (77.41 KB, application/zip)
2014-09-15 02:56 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-09-15 02:56:46 UTC
Created attachment 8061 [details]
Test case

On Android only, maybe only on LG phones, EntryCells in TableViews and ListViews lose focus while typing.

This behavior depends on the implementation of the default "LG Keyboard" on LG phones. Other soft keyboards might be affected too.


## Workaround on device

1. Install the "Google Keyboard" from the Google Play store. 
2. Set the "Google Keyboard" as the default input method instead of the "LG Keyboard".


## Workaround in the app

Add the following attribute to the MainActivity in the Android application project:
WindowSoftInputMode = Android.Views.SoftInput.AdjustPan


## Steps to reproduce

1. Run the Android project from the attached test case.
This test case is just a new "Visual C# -> Mobile Apps -> Blank App (Xamarin.Forms Portable)" with the code from [3].
> [3] http://androidapi.xamarin.com/?link=T%3aXamarin.Forms.EntryCell

2. Once the app launches on device, tap within the editable portion of the EntryCell.

3. Start typing "hello" using the on-screen keyboard.


## Result on LG Optimus L9 running Android 4.1.2, using the "LG Keyboard"

When the autocompletion bar appears, it immediately disappears and the text field loses focus. Further entries into the keyboard result in no changes to the text field.


## Expected result (using the "Google Keyboard")

The text autocompletion bar stays on screen, and the text field stays focused until the user explicitly sets focus outside of the text field.

The Android 4.0.3, 4.1.2, and 4.4 emulators all show this correct behavior.


## Results on iPhone, Windows Phone Emulator

By default neither of these systems shows an autocompletion menu. The text field stays focused as expected on both platforms. Dragging across the letters "hello" on Windows Phone *does* show an autocompletion menu. That autocompletion menu stays on screen as expected, and the text field does not lose focus.


## Closely related bugs
"[Android only] An Entry in a ViewCell loses focus immediately"
https://bugzilla.xamarin.com/show_bug.cgi?id=21373

"Android - ViewCell - Entry and non default Keyboard type"
https://bugzilla.xamarin.com/show_bug.cgi?id=20786


## Knowledge base article
"EntryCells and Entry views within ViewCells lose focus on Android"
http://kb.xamarin.com/customer/portal/articles/1690276


## Version information

Xamarin.Forms versions tested:
1.0.6186        (+ Xamarin Support Library v4 19.0.2)
1.2.2.6243      (+ Xamarin Support Library v4 20.0.0.3)
1.2.3.6249-pre2 (+ Xamarin Support Library v4 20.0.0.3)


Xamarin   3.5.58.0 (6b70b1e28c5a733187f7659220da4c0ff61ab2b1)
Comment 1 Sadik Ali 2015-01-23 01:09:21 UTC
I have checked this issue and observe that I am not getting this behavior with Xamarin.Forms: 1.3.1.6297 and X.Forms 1.3.2.6299 pre1.

I am able to reproduce this behavior with Xamarin.Forms: 1.3.0.6275 but I am not getting this issue does not exist with Xamarin.Forms: 1.3.1.6297

Steps I followed:

1.  Create a Blank App( Xamrin.Forms Portable) application.
2.  Use the following test case
      http://androidapi.xamarin.com/?link=T%3aXamarin.Forms.EntryCell
3.  Build and deploy application on LG nexus 5 ( Android 5.0)

Screencast  (Keyboard setting) : http://www.screencast.com/t/FlljrdX1A

This issue has been fixed. For now I am changing it's status to Resolved. Please check this with updated Xamarin.Forms package. 
If you face the same problem after updating the Xamarin.Forms package please reopen this issue.
Comment 2 sinnam.singh 2017-01-31 11:20:06 UTC
Still this issue is exist Xamarin Form V-2.3.2.127.
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-01-31 18:19:14 UTC
This exact bug report can be considered closed at this time since it has been marked as resolved for approximately 2 years.  For any appearances of similar issues in versions higher than 1.3.1.6297, please file new bug reports and be sure to include as many details [1] as possible (ideally including a test case).  Thanks in advance!

[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/
Comment 4 sinnam.singh 2017-02-01 04:41:55 UTC
I am facing this issue in Nexus 5X, Lenevo A600, One Plus 3 and other device as well.
Below is my data template in which i am binding entry fields dynamically 

<DataTemplate x:Key="Numeric">
        <ViewCell>
          <ViewCell.View>
            <StackLayout Padding="0">
              <StackLayout Spacing="0" Padding="10">
                <Grid ColumnSpacing="0" Padding="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                  <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                  </Grid.RowDefinitions>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                  </Grid.ColumnDefinitions>
<controls:ExtendedLabel Text="{Binding .Question}" Style="{StaticResource ListItemInspectionLabelStyleWordwrap}" HorizontalOptions="Start" VerticalOptions="Start" Grid.Row="0" Grid.Column="0" />
                  <controls:XXXEntry x:Name="InputEntry" IsEnabled="{Binding .CanRespond}" FontSize="12" TextChanged="OnNumericTextChanged" HeightRequest="50" Keyboard="Numeric" Focused="OnNumericFocus" Unfocused="OnNumericUnFocus" HorizontalOptions="FillAndExpand" VerticalOptions="End" ClassId="{Binding .QuestionId}" Grid.Row="1"Grid.Column="0" />
                </Grid>
              </StackLayout>
              <BoxView Style="{StaticResource ListDividerStyle}" />
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>

"XXXEntry" is my entry control if we more than 5 items(with scroll) then after entering/changing any value in 3rd entry field then on each key press unFocus and Focus will fire more than 2-2 times.

Please do needful.
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2017-02-01 17:48:48 UTC
Thanks for the information.  Please file that onto a new bug report when you get a chance so that the team can follow-up with any additional questions they might have.  (There is an advantage for you to be the reporter of the new bug because then you will be able to adjust the status of the bug to "reopened" after providing additional info, or after checking if the provided answer resolves the issue.)  Thanks in advance!
Comment 6 sinnam.singh 2017-02-02 04:20:06 UTC
Thanks for response. I have already raised bug into buzilla , Bug Id 51807