Skip to content

Closing Popup on back button with android:enableOnBackInvokedCallback="true" #347

@JamesBrooksbankIceland

Description

@JamesBrooksbankIceland

Description

We discovered an issue with our sfpopup where the back button wasn't working when it was opened. It closed when the user tapped outside of the popup but not on the back button.

So after creating a new app and replicating our code, we noticed that the back button was working. However, the production app wasn't. After a bit I discovered that the backbutton wasn't working on the popup because of android:enableOnBackInvokedCallback="true"

When true, then the back button does not close when the popup menu is open.

Steps to Reproduce

  1. Create new maui project
  2. In page add a popup and button which shows
  3. Make sure in the android manifest this is set android:enableOnBackInvokedCallback="true"
  4. Open the popup
  5. Try closing by pressing the back button and it's not working

Problem is with version 1.0.9

My sample project is here in github
https://github.com/[JamesBrooksbankIceland/PopupmenuSample](https://github.com/JamesBrooksbankIceland/PopupmenuSample)

.NET Version

.NET 10.0

Version with bug

1.0.7

Is this a regression from previous behavior?

No, this is a new issue

Last Known Working Version

1.0.6

Affected platforms

Android

Affected Platform Versions

Android 14 at least

Have you found a workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions