Skip to content

Window.ModalPopping closes app when e.Cancel = true #23462

Description

@brianlagunas

Description

Using a custom Window class, when hooking into the Window.ModalPopping event, setting the e.Cancel = true causes the app to close when the Android hardware button is pressed for a modal navigation stack.

The offending code can be found in the App.xaml.cs file

Steps to Reproduce

  1. Clone the reproduction repo
  2. Run the App on an Android enumlator with API 34
  3. Click the button on ViewA to Navigate to ViewB
  4. Click the button on ViewB to Navigate to ViewC
  5. Hit the Android Hardware back button
  6. Observe the modal view is no popped, but the App closes.

What I expect to happen is for the modal view to not be popped, and the app to stay running on screen.

For more context, the Prism Library uses a custom Window to take control of the navigation process on a go back for the modal navigation stack. We need to cancel the built-in popping that is invoked by the hardware back button, and use our pop code instead. This gives us the ability to prevent a navigation based on our IConfirmationRequest interface. If the result of our IConfirmationRequest is true we will do the pop modal again, if the result is false, we will not pop the modal and keep the user on the current view.

Link to public reproduction project repository

https://github.com/brianlagunas/WindowModalPoppingBug

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

Android

Affected platform versions

Android API 34

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-navigationNavigationPagep/2Work that is important, but is currently not scheduled for releasepartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/try-latest-versionPlease try to reproduce the potential issue on the latest public versions/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions