Skip to content

Commit 51e1228

Browse files
Fire Action PopupOptions.OnTappingOutsideOfPopup when Android Back Button Pressed (#2799)
1 parent 0e1ee9e commit 51e1228

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ public async Task CloseAsync(PopupResult result, CancellationToken token = defau
101101

102102
protected override bool OnBackButtonPressed()
103103
{
104-
// Only close the Popup if CanBeDismissedByTappingOutsideOfPopup is true
105-
if (GetCanBeDismissedByTappingOutsideOfPopup(popup, popupOptions))
104+
// When the Android Back Button is tapped, we only close the Popup if the tapOutsideOfPopupCommand can execute
105+
// In other words, we'll only close the Popup when CanBeDismissedByTappingOutsideOfPopup is true
106+
if (tapOutsideOfPopupCommand.CanExecute(null))
106107
{
107-
CloseAsync(new PopupResult(true), CancellationToken.None).SafeFireAndForget();
108+
tapOutsideOfPopupCommand.Execute(null);
108109
}
109110

110111
// Always return true to let the Android Operating System know that we are manually handling the Navigation request from the Android Back Button

0 commit comments

Comments
 (0)