Skip to content

Conversation

@IeuanWalker
Copy link
Contributor

Description of Change

Fix Android screen reader accessibility

As you can see from the before video, the non-interactive elements (labels) arnt focusable to the screenreader. And the popup view itself is.

Before After
android-before.mp4
android-after.mp4

I've tested iOS and it is unchanged from before, and behaves the same as the after video on Android.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

IeuanWalker and others added 3 commits November 21, 2025 17:21
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.
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.
Removed comments explaining the accessibility setup for the
overlay Grid and PopupBorder. No functional changes were
made to the accessibility behavior, as the relevant
`AutomationProperties.SetIsInAccessibleTree` calls remain
unchanged. The comments were likely removed for clarity or
to reduce redundancy.
Copilot AI review requested due to automatic review settings November 22, 2025 19:16
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 fixes Android screen reader accessibility for the Popup component by ensuring that non-interactive container elements are excluded from the accessibility tree, allowing screen readers to properly focus on interactive and content elements within the popup.

Key Changes:

  • Set IsInAccessibleTree to false for popup container elements (PopupPageLayout and PopupBorder) to improve screen reader navigation
  • Added semantic focus to the first label in the ButtonPopup sample to demonstrate proper accessibility behavior
  • Applied formatting improvements to the ButtonPopup.xaml sample

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs Excludes popup container elements from accessibility tree to fix Android screen reader focus issues
samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml.cs Adds event handler to set semantic focus on the title label when loaded
samples/CommunityToolkit.Maui.Sample/Views/Popups/ButtonPopup.xaml Wires up Loaded event and applies formatting improvements (tabs to spaces)

Update Label_Loaded method with nullability and logic

The `Label_Loaded` method in `ButtonPopup.xaml.cs` was updated to
accept a nullable `sender` parameter by changing its signature
to `void Label_Loaded(object? sender, EventArgs e)`.

Additionally, the method implementation was added to check if
the `sender` is of type `Label`. If so, it casts the `sender`
to a `Label` and calls the `SetSemanticFocus` method on it.
@IeuanWalker
Copy link
Contributor Author

This is the website is use to validate accessibility behaviour, as you can see this PR matches what is expected - https://www.magentaa11y.com/#/native-criteria/notifications/modal?tab=4

@IeuanWalker
Copy link
Contributor Author

IeuanWalker commented Dec 19, 2025

@TheCodeTraveler @jfversluis hoping someone can take a look at this. Plan to migrate from Mopups to the toolkit but accessibility is a legal requirement for us.

@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) January 10, 2026 08:34
@bijington
Copy link
Contributor

@IeuanWalker thanks for this! Sorry it's taken so long for someone to look at it

@IeuanWalker
Copy link
Contributor Author

@bijington no prob, thanks for taking a look :)

@bijington
Copy link
Contributor

@bijington no prob, thanks for taking a look :)

You're UK based right? It's a distance from Wales but will you be coming to MAUI Day next month in London?

@IeuanWalker
Copy link
Contributor Author

IeuanWalker commented Jan 11, 2026

@bijington ye based in Cardiff. I want too, messaged my manager about it few days ago, not heard back yet :/ will chase him tomorrow lol

Just hope there are tickets left 🤞

@bijington
Copy link
Contributor

@bijington ye based in Cardiff. I want too, messaged my manager about it few days ago, not heard back yet :/ will chase him tomorrow lol

Just hope there are tickets left 🤞

If you get approval and there are no tickets let me know 👍

@IeuanWalker
Copy link
Contributor Author

@bijington got approval and a ticket 👌

Do you know what time it starts/ opens and when it ends? Need to look at booking a train for it

@bijington
Copy link
Contributor

@bijington got approval and a ticket 👌

Do you know what time it starts/ opens and when it ends? Need to look at booking a train for it

Amazing news! I believe we had the venue from 08:30 but talks will only start from 09:00-09:15. And I think we have to be out by 17:30 at the latest. We will be heading to a place for a drink after if you need to kill time for the next train 👍

Also if it's easier feel free to reach out via Discord (my username is the same) and I will probably be more responsive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Popup: Android screen reader accessibility

3 participants