Skip to content

Conversation

@TheCodeTraveler
Copy link
Collaborator

@TheCodeTraveler TheCodeTraveler commented Jul 8, 2025

Description of Change

This PR updates the logic in PopupPage.OnBackButtonPressed to fire Action PopupOptions.OnTappingOutsideOfPopup and dismiss the Popup when CanBeDismissedByTappingOutsideOfPopup is true.

Linked Issues

PR Checklist

Additional information

Tp avoid duplicating code, this PR leverages the existing logic in ICommand tapOutsideOfPopupCommand

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Android back button handling in PopupPage.OnBackButtonPressed so that tapping the back button now invokes the OnTappingOutsideOfPopup action and dismisses the popup when allowed.

  • Switched the dismissal check from GetCanBeDismissedByTappingOutsideOfPopup to tapOutsideOfPopupCommand.CanExecute(null)
  • Replaced the direct CloseAsync call with tapOutsideOfPopupCommand.Execute(null)
  • Ensures the popup remains open by always returning true
Comments suppressed due to low confidence (1)

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

  • Add unit tests to verify that OnBackButtonPressed correctly fires the OnTappingOutsideOfPopup action and dismisses the popup when CanBeDismissedByTappingOutsideOfPopup is true, and remains inert otherwise.
	protected override bool OnBackButtonPressed()

Copy link
Contributor

@bijington bijington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TheCodeTraveler TheCodeTraveler merged commit 51e1228 into main Jul 8, 2025
11 checks passed
@TheCodeTraveler TheCodeTraveler deleted the Fire-`OnTappingOutsideOfPopup`-Action-when-Android-Back-Button-Pressed branch July 8, 2025 17:52
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants