This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 45067 - No way of cleanly dismissing soft keyboard in UWP
Summary: No way of cleanly dismissing soft keyboard in UWP
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: 2.4.0
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-10-05 15:54 UTC by NMackay
Modified: 2017-08-30 18:28 UTC (History)
9 users (show)

See Also:
Tags: ac uwp entry keyboard focus
Is this bug a regression?: Yes
Last known good build:


Attachments
VS2015 Solution (iOD, Droid & UWP), recreates keyboard issue in UWP (300.97 KB, application/x-rar)
2016-10-05 15:54 UTC, NMackay
Details
updated repro (287.76 KB, application/x-zip-compressed)
2017-07-13 16:32 UTC, Jimmy [MSFT]
Details

Description NMackay 2016-10-05 15:54:19 UTC
Created attachment 17888 [details]
VS2015 Solution (iOD, Droid & UWP), recreates keyboard issue in UWP

IN UWP is impossible to dismiss the keyboard if you only have entry fields enabled on a page.

In this sample there is two entries, a login button and two other buttons (hidden in UWP due to known modal bug that has been fixed pending PR approval).

In Android or iOS when you press return/enter on the soft keyboard the focus is set to the button and despite the button been disabled by the command focus is not passed back to the entry, in UWP focus is always passed back due no other control been enabled on the face or no control that supports focus is available.

Test 1:

Enter text in username
Enter text in password
Press enter on soft keyboard (simulates authentication in command)
Android: Keyboard is dismissed. UWP: Keyboard remains as focus is passed back to username

Test 2:

Enter text in username
Enter text in password
Press back on device to dismiss keyboard
Tap Login button
Android: Command executes. UWP: Command executes but focus is passed back to username

Test 3:

Swap the commented entry fields for the ones been used ones in LoginPage.xaml (commented ones disable the entry)

Enter text in password
Enter text in username
Press enter on soft keyboard (simulates authentication in command)
Android: Keyboard is dismissed. UWP: Keyboard is dismissed but keyboard flashes and page flickers

There seems to be no easy way to dismiss the keyboard in UWP and as the expected behavior works in iOS and Android it has to be considered as a bug. It should be consistent over all three platforms.
Comment 2 Rui Marinho 2017-03-20 19:17:32 UTC
Should be fixed in 2.3.5-pre1
Comment 5 Jimmy [MSFT] 2017-07-13 16:37:12 UTC
I ran the attached project with Forms 2.3.5-pre6 and 2.3.5.117-nightly and I was still able to reproduce the issue. I am setting the report back to confirmed for further investigation.
Comment 6 Jimmy [MSFT] 2017-08-30 18:28:04 UTC
Test #1 and #3 in the description are fixed in 2.4.0-pre2. Pressing Enter now dismisses the keyboard and it does not reappear or flicker. Regarding test #2, the fix does not apply in this case because the keyboard has already been dismissed. Since the login command disables the Buttons on the page, focus will be passed to another control due to how UWP behaves.

The recommended approach would be to also disable the Entry controls when the commands runs, as in test #3, in order to ensure consistent behavior across the platforms.

Note You need to log in before you can comment on or make changes to this bug.