Skip to content

Commit f3484fe

Browse files
Update PopupPage.shared.cs
1 parent 49472e7 commit f3484fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,16 @@ public async Task CloseAsync(PopupResult result, CancellationToken token = defau
104104

105105
popupClosedEventManager.HandleEvent(this, result, nameof(PopupClosed));
106106
}
107-
108-
// Prevent the Android Back Button from dismissing the Popup if CanBeDismissedByTappingOutsideOfPopup is true
107+
109108
protected override bool OnBackButtonPressed()
110109
{
110+
// Only close the Popup if PopupOptions.CanBeDismissedByTappingOutsideOfPopup is true
111111
if (popupOptions.CanBeDismissedByTappingOutsideOfPopup)
112112
{
113113
CloseAsync(new PopupResult(true), CancellationToken.None).SafeFireAndForget();
114114
}
115115

116+
// Always return true to let the Android Operating System know that we are manually handling the Navigation request from the Android Back Button
116117
return true;
117118
}
118119

0 commit comments

Comments
 (0)