Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing a modal navigation page with physical Escape key corrupts the navigation stack #23463

Open
filipnavara opened this issue Jul 5, 2024 · 3 comments
Labels
area-navigation NavigationPage p/2 Work that is important, but is currently not scheduled for release platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@filipnavara
Copy link
Member

Description

iOS modal pages with NavigationPage can be closed by the physical Escape key (tested in iOS Simulator). Once that is done, no other modal page is presented since the navigation stack ends up in inconsistent state.

Video:
https://github.com/dotnet/maui/assets/1764393/ed05543c-b263-4180-a6a6-80b111ec0be8

Steps to Reproduce

  1. Push a new NavigationPage to the modal stack
  2. Close the page by pressing the physical Escape key
  3. Try to push a new NavigationPage to the modal stack, observe it fails

Link to public reproduction project repository

https://github.com/filipnavara/maui-dark-mode-ios-bug

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17.5

Did you find any workaround?

No response

Relevant log output

No response

@filipnavara filipnavara added the t/bug Something isn't working label Jul 5, 2024
Copy link
Contributor

github-actions bot commented Jul 5, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@filipnavara
Copy link
Member Author

Nasty workaround:

We already had an overridden navigation renderer with some additional functionality (class ExtendedNavigationPageRenderer : Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer).

I added AddKeyCommand(UIKeyCommand.Create(UIKeyCommand.Escape, 0, new Selector("closeModalPopup"))); to the constructor to intercept the Escape key.

It uses a pre-existing CloseModalPopup method with selector that we already had in there:

		[Export("closeModalPopup")]
		public async void CloseModalPopup()
		{
			if (closeButton != null)
			{
				closeButton = null;
				ParentViewController.PresentationController.WeakDelegate = null;
				await Element.Navigation.PopModalAsync();
			}
		}

@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 8, 2024
@RoiChen001
Copy link

I can repro this issue at iOS platform on the latest 17.11.0 Preview 2.1 (8.0.61).

@PureWeen PureWeen added the p/2 Work that is important, but is currently not scheduled for release label Jul 9, 2024
@PureWeen PureWeen added this to the Backlog milestone Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-navigation NavigationPage p/2 Work that is important, but is currently not scheduled for release platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants