Skip to content

Commit 6cc673d

Browse files
committed
Improve PopupPage accessibility and simplify tap handling
Removed the `TapGestureRecognizer` from the `PopupPage` constructor to simplify tap handling logic. Updated `PopupPageLayout` to enhance accessibility by excluding the overlay `Grid` and `PopupBorder` from the accessibility tree, ensuring only relevant popup content is accessible to assistive technologies.
1 parent 1873607 commit 6cc673d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public PopupPage(Popup popup, IPopupOptions? popupOptions)
4646
await CloseAsync(new PopupResult(true));
4747
}, () => GetCanBeDismissedByTappingOutsideOfPopup(popup, popupOptions));
4848

49-
5049
var pageTapGestureRecognizer = new TapGestureRecognizer();
5150
pageTapGestureRecognizer.Tapped += HandleTapGestureRecognizerTapped;
5251

@@ -251,6 +250,13 @@ public PopupPageLayout(in Popup popupContent, in IPopupOptions options)
251250
PopupBorder.SetBinding(Border.StrokeThicknessProperty, static (IPopupOptions options) => options.Shape, source: options, mode: BindingMode.OneWay, converter: new BorderStrokeThicknessConverter());
252251

253252
Children.Add(PopupBorder);
253+
254+
// Configure accessibility:
255+
// - Exclude the overlay Grid from accessibility to hide the background dimming area
256+
// - Exclude the PopupBorder from accessibility (it's just a visual container)
257+
// - Popup and its inner content children will be accessible directly
258+
AutomationProperties.SetIsInAccessibleTree(this, false);
259+
AutomationProperties.SetIsInAccessibleTree(PopupBorder, false);
254260
}
255261

256262
public Border PopupBorder { get; }

0 commit comments

Comments
 (0)