From 6cc673df0045666c63da4b88bddf9b26c4a7b206 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 21 Nov 2025 17:21:12 +0000 Subject: [PATCH 1/4] 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. --- src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs index 5d3f65ec8c..820d484a86 100644 --- a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs +++ b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs @@ -46,7 +46,6 @@ public PopupPage(Popup popup, IPopupOptions? popupOptions) await CloseAsync(new PopupResult(true)); }, () => GetCanBeDismissedByTappingOutsideOfPopup(popup, popupOptions)); - var pageTapGestureRecognizer = new TapGestureRecognizer(); pageTapGestureRecognizer.Tapped += HandleTapGestureRecognizerTapped; @@ -251,6 +250,13 @@ public PopupPageLayout(in Popup popupContent, in IPopupOptions options) PopupBorder.SetBinding(Border.StrokeThicknessProperty, static (IPopupOptions options) => options.Shape, source: options, mode: BindingMode.OneWay, converter: new BorderStrokeThicknessConverter()); Children.Add(PopupBorder); + + // Configure accessibility: + // - Exclude the overlay Grid from accessibility to hide the background dimming area + // - Exclude the PopupBorder from accessibility (it's just a visual container) + // - Popup and its inner content children will be accessible directly + AutomationProperties.SetIsInAccessibleTree(this, false); + AutomationProperties.SetIsInAccessibleTree(PopupBorder, false); } public Border PopupBorder { get; } From a54d5b8bdc67f68c0f986500d4a84b1d401b2d1e Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 21 Nov 2025 17:44:52 +0000 Subject: [PATCH 2/4] Improve ButtonPopup accessibility and code formatting Refactored the `VerticalStackLayout.Resources` section in `ButtonPopup.xaml` for better readability and consistency. Added a `Loaded` event handler (`Label_Loaded`) to the `Label` with the `Title` style to set semantic focus on load, enhancing accessibility. Implemented the `Label_Loaded` method in `ButtonPopup.xaml.cs` to handle this functionality. --- .../Views/Popups/ButtonPopup.xaml | 58 +++++++++---------- .../Views/Popups/ButtonPopup.xaml.cs | 8 +++ 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml b/samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml index 1537a61ef1..848122230e 100644 --- a/samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml @@ -6,37 +6,37 @@ xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" BackgroundColor="LightCoral"> - - - - - - - - - + + + + + + + + + -