Bug 27698 - [iOS] DisplayAlert and DisplayActionSheet are shown below master page
Summary: [iOS] DisplayAlert and DisplayActionSheet are shown below master page
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 10:13 UTC by Michael Rumpler
Modified: 2017-02-02 15:26 UTC (History)
8 users (show)

Tags: ios tablet alert action sheet masterdetailpage ipad
Is this bug a regression?: ---
Last known good build:


Attachments
Repro project (272.24 KB, application/x-zip-compressed)
2016-04-11 08:47 UTC, Michael Rumpler
Details
Screenshot of ShowAlert under Master (84.95 KB, image/png)
2016-04-11 08:49 UTC, Michael Rumpler
Details
Screenshot of ShowActionSheet under Master (398.29 KB, image/png)
2016-04-11 08:50 UTC, Michael Rumpler
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 Michael Rumpler 2015-03-05 10:13:48 UTC
My MainPage is a MasterDetailPage. If the user does something on the master page which requires to show an alert or action sheet, then the popup should be shown on top of the master and detail pages and no input should be possible.
But on the iPad 2 in portrait mode the master page stays on top and the popups are shown below it. The master page can still be used while you see part of the popup under it. It looks like the popups are hooked up to the detail page even though I called DisplayAlert or DisplayActionSheet on the MasterDetailPage itself.

When the iPad is in landscape mode, the master and detail pages are always visible and the popup is in the middle of the display. This is fine.
On Android the popups are also shown in the middle of the display in both portrait and landscape.
I didn't check WinPhone.

This can easily be reproduced in a blank solution with only this code in App.cs:

		public App()
		{
			var showAlertBtn = new Button { Text = "DisplayAlert" };
			var showActionSheetBtn = new Button { Text = "DisplayActionSheet" };

			var master = new ContentPage
			{
				Title = "Master",
				Content = new StackLayout
				{
					VerticalOptions = LayoutOptions.Center,
					Children = {
						showAlertBtn,
						showActionSheetBtn
					}
				}
			};

			// The root page of your application
			MainPage = new MasterDetailPage
			{
				Master = master,
				Detail = new ContentPage
				{
					Content = new Label { Text = "Details", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }
				}
			};

			showAlertBtn.Clicked += (s, e) => { MainPage.DisplayAlert("Title", "Message", "Cancel"); };
			showActionSheetBtn.Clicked += (s, e) => { MainPage.DisplayActionSheet("Title", "Cancel", null, "Button1", "Button2", "Button3"); };
		}

I tested this with Xamarin.Forms 1.3.4.6332, 1.3.5.6337 and 1.4.0.6336-pre1.
Comment 1 Michael Rumpler 2015-03-19 10:38:29 UTC
It works if the MasterBehavior is set to Split - but thats not  desired in all apps.
Comment 2 Rui Marinho 2015-05-19 11:18:54 UTC
In your example you didn't specify your master Behaviour, so i assume this was happening in portrait mode where the master works as a popover.
Or when you specify the MasterBehavior to be Popover , right?
Comment 3 Michael Rumpler 2015-05-20 03:06:58 UTC
I didn't set it, so it is MasterBehavior.Default. Unfortunately http://iosapi.xamarin.com/?link=T%3aXamarin.Forms.MasterBehavior doesn't fully explain what that means.
Comment 4 mpournakas_p 2016-02-19 16:09:29 UTC
Same Problem with Xamarin.Forms 2.0.1.6506.

I call an await Navigation.PopModalAsync to close a waiting modal page
and i call then DisplayActionSheet with a result and DisplayActionSheet not appear.
with message Warning: Attempt to present <UIAlertController: 0x7fa237e50d40> on <xxx_iOS_NavigationPageRenderer: 0x7fa2342ed400> whose view is not in the window hierarchy!

If i call DisplayAlert it works.
Comment 5 Bryan Hunter 2016-04-08 19:54:43 UTC
Hi Michael. We have queued this issue for triage. If you (or one the commenters above) have a reproduction handy please attach it here. That will help the engineers move faster.

An ideal reproduction starts with a clean Xamarin.Forms project and adds just the code necessary to demonstrate the issue. For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Thanks!
Comment 6 Michael Rumpler 2016-04-11 08:47:58 UTC
Created attachment 15667 [details]
Repro project

The reproduction is the code I pasted in the original comment. However, I copied and pasted it in a sample project for you.

I tested it again with XF 2.0.0.6482 and 2.2.0.5-pre2 and it still shows the same problem as described a year ago.
Comment 7 Michael Rumpler 2016-04-11 08:49:52 UTC
Created attachment 15668 [details]
Screenshot of ShowAlert under Master
Comment 8 Michael Rumpler 2016-04-11 08:50:19 UTC
Created attachment 15669 [details]
Screenshot of ShowActionSheet under Master
Comment 9 Bryan Hunter 2016-04-11 15:24:24 UTC
Thank you!
Comment 10 Jimmy [MSFT] 2016-12-13 19:23:41 UTC
I can no longer reproduce this issue with Forms 2.3.4-pre1
Comment 11 Michael Rumpler 2016-12-23 11:58:36 UTC
As 2.3.4-pre1 is not publicly available I cannot check this. 2.3.3.175 still has the problem.
Comment 12 Michael Rumpler 2017-02-02 15:26:50 UTC
I tried it with 2.3.4.184-pre1 now and can confirm that it is fixed.