Bug 48307 - ShouldPreserveKeyboardOnResume exhibits the same behavior regardless of it's value
Summary: ShouldPreserveKeyboardOnResume exhibits the same behavior regardless of it's ...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-11-29 16:36 UTC by David Britch
Modified: 2018-03-14 18:17 UTC (History)
6 users (show)

Tags: platformspecific pan keyboard ac
Is this bug a regression?: ---
Last known good build:

Sample (2.36 MB, application/zip)
2016-11-29 16:36 UTC, David Britch

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:

Description David Britch 2016-11-29 16:36:22 UTC
Created attachment 18705 [details]

The initial pull request for this feature (#441) explains that on backgrounding, AppCompat hides the soft keyboard but doesn't show it when the app resumes. Hence a new platform-specific is added to control whether the soft keyboard is displayed or not.

However, in my sample (attached) the soft keyboard is shown (when the soft keyboard input mode is set to AdjustResize) on resume, regardless of the value of ShouldPreserveKeyboardOnResume. As per the PR, the soft keyboard is never shown when its input mode is Pan.

Repro steps:

1. Run app and navigate to the lifecycle events page.
2. Click in the Entry to display the soft keyboard.
3. Pause/sleep the app.
4. Resume the app.

Result: The soft keyboard is displayed when the app resumes.

Expected result: The soft keyboard isn't displayed because ShouldPreserveKeyboardOnResume = false (set in App.xaml).
Comment 1 adrianknight89 2016-11-29 18:46:05 UTC
I can confirm that AdjustResize seems to be showing keyboard automatically. At the time I wrote the PR, this didn't seem to be the case, so I'm not sure what got changed. There was a lot of activity in 2.3.4-pre1.

For now, we could revert this change and add it back in if we need it. We could provide sample code to go with it.

Please note that changing to AdjustResize seems to be creating a white background at the top. See https://developer.xamarin.com/guides/xamarin-forms/user-interface/platform-specifics/consuming/#soft_input_mode

This doesn't look good at all. Can you please review this PR: https://github.com/xamarin/Xamarin.Forms/pull/422? It's been almost two months since it was submitted. I believe it could fix the white background issue. The problem is that Resize is pushing the underlay below (the underlay can be visible underneath the white background) AND the status bar has no color set so its transparency shows white.

This PR (https://github.com/xamarin/Xamarin.Forms/pull/552) will let you skip adding the underlay for full customization.
Comment 2 adrianknight89 2016-11-29 18:50:45 UTC
This whole underlay stuff seems to be added for XF's hacky MasterDetailPage solution.
Comment 3 Paul DiPietro [MSFT] 2017-03-27 17:39:30 UTC
Updating that this still occurs as of the
Comment 4 Paul Brenner 2018-03-07 21:11:44 UTC
See https://github.com/xamarin/Xamarin.Forms/issues/2045
Comment 5 Samantha Houts [MSFT] 2018-03-14 18:17:59 UTC
Please follow the issue on GitHub for updates. Thank you.