Prevent Popup From Being Dismissed when Tapped Inside Popup#2800
Prevent Popup From Being Dismissed when Tapped Inside Popup#2800TheCodeTraveler merged 7 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a workaround for an Android-specific issue where taps on the box view behind the popup border still trigger the underlying gesture. It adds an empty TapGestureRecognizer to the PopupBorder to absorb taps.
- Prevents propagation of background taps through the popup on Android
- Adds an empty
TapGestureRecognizertoPopupBorder
Comments suppressed due to low confidence (2)
src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs:205
- Consider adding a UI test to verify that this workaround prevents taps on Android from propagating to underlying elements, ensuring this behavior is covered and preventing regressions.
PopupBorder.GestureRecognizers.Add(new TapGestureRecognizer());
src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs:204
- Expand this comment to include a TODO referencing issue #2795 and clarify that this workaround should be removed once the underlying MAUI bug is fixed.
// Currently .NET MAUI allows for the TapGestureRecognizer added to the BoxView behind this Border to be triggered with a tap on Android.
|
Have you tried toggling |
I did stick a breakpoint in the code and saw that it was set to |
Why not just check if the touch point is inside the border bounds? Placing a TapGestureRecognizer just to mitigate the issue will lead to other issues... Like potential nested Gesture Recognizes. |
Nice idea! I have included this in the PR now. It is more involved but I think it provides a clearer intent. @TheCodeTraveler what do you think? |
|
Genius!! We should've been using this all along 💯 popupPageLayout.PopupBorder.Bounds.Contains(position.Value) |
I am glad that I could help... MANY more from where this came from. Take a look at a couple... https://www.linkedin.com/feed/update/urn:li:activity:7269824678708318208/ |
|
@TheCodeTraveler good follow up with removing the BoxView |
Description of Change
This PR introduces a workaround to swallow any touches on our internal Border control to avoid the touches rippling through to the background BoxView.
Linked Issues
This is more of a workaround than a fix but it does solve the issue for now
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information