Bug 30736 - Modal pages are shown under Alerts and Actionsheets
Summary: Modal pages are shown under Alerts and Actionsheets
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.2
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
Depends on:
Reported: 2015-06-03 12:38 UTC by John Miller [MSFT]
Modified: 2015-07-07 11:39 UTC (History)
2 users (show)

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

Test Case (339.32 KB, application/zip)
2015-06-03 12:38 UTC, John Miller [MSFT]

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 John Miller [MSFT] 2015-06-03 12:38:25 UTC
Created attachment 11450 [details]
Test Case


   If a page is shown using NavigationPage.PushModalAsync(...) while an Alert or Actionsheet is being displayed, it will appear behind the Alert/Actionsheet.

**Steps to Reproduce:**

   1. Run the attached sample on Android
   2. Tap the button to show an Alert
   3. Wait 1 second
   4. Observe the Modal page shown underneath

**Actual Results:**

   The modal is shown behind the alert/actionsheet.

**Expected Results:**

   The alert/actionsheet should be closed/dismissed so that the modal page is shown on top. 

**Build Date & Platform:**

   XF 1.4.2
   XA 5.1.1
   API 21

**Additional Information:**

   iOS produces the expected behavior. 
   There does not seem to be a way to programmatically dismiss these alerts/actionsheets to work around this before showing a modal page.
Comment 1 Ryan Henderson 2015-06-12 16:44:52 UTC
In addition to alerts and actionsheets, pickers (and date pickers) also show over modal pages in a similar way. The original attached project included an example of this behavior.
Comment 2 Jason Smith [MSFT] 2015-07-06 15:45:17 UTC
This is expected behavior.
Comment 3 Ryan Henderson 2015-07-06 16:37:53 UTC
If this is expected behavior, then I don't see how it's possible to do something like push a login page after a timeout period if the user _might_ have an action sheet open (since the action sheet would display _on top of_ the pushed login page). Am I correct? Is there a recommended workaround?
Comment 4 John Miller [MSFT] 2015-07-07 08:48:34 UTC

You could work around this by making sure to dismiss any open actionsheets/alerts/pickers before pushing the modal page.
Comment 5 Ryan Henderson 2015-07-07 09:03:32 UTC

Thanks for your response, John. I was unable to find a way to programmatically dismiss actionsheets, pickers, and alerts. How can I do this?
Comment 6 John Miller [MSFT] 2015-07-07 10:06:23 UTC

Sorry for the confusion!

I don't think Forms has something packaged with it. I was using a different library that had a display/dismiss method. You could implement this too using the dependency service so that you have access to the dismiss methods on a UIAlertView, etc.
Comment 7 Ryan Henderson 2015-07-07 11:39:09 UTC
On Android, I was unable to find a solution for dismissing programmatically, even using a custom renderer. The few solutions I found for native Android did not work in a Forms custom renderer. So currently, I'm unaware of any way to programmatically dismiss actionsheets, alerts, and pickers in Xamarin. 

It seems that if this is indeed expected behavior for Xamarin, there should be a way to programmatically dismiss these windows in each platform. Could you provide any documentation or help on how to do this on both iOS and Android?