[Accessibility] Add 'button' for TalkBalk on Android Tap Gesture Recognizers#28393
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the accessibility semantics for Android tap gestures so that they are announced as buttons, similar to iOS behavior, while retaining the existing "double tap to activate" announcement for primary tap gestures.
- Updated SemanticExtensions.cs to have TapGestureRecognizerNeedsDelegate delegate to the new button announcement check.
- Modified the Android accessibility update logic to use separate checks for action click and button announcement.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Controls/src/Core/Platform/SemanticExtensions.cs | Updated internal accessibility helper methods to differentiate between action click and button announcement. |
| src/Controls/src/Core/Platform/Android/Extensions/SemanticExtensions.cs | Adjusted the Android accessibility node update logic to add both the click action and the button class name when applicable. |
Comments suppressed due to low confidence (3)
src/Controls/src/Core/Platform/SemanticExtensions.cs:9
- [nitpick] Review if renaming the delegate check to directly reference button announcement accurately reflects the intent; if the purpose is to indicate a delegate is needed, the naming might be misleading.
=> virtualView.TapGestureRecognizerNeedsButtonAnnouncement();
src/Controls/src/Core/Platform/Android/Extensions/SemanticExtensions.cs:14
- Verify that replacing the previous delegate check with a call to TapGestureRecognizerNeedsActionClick preserves the intended behavior for adding the click accessibility action, as this could affect which gestures trigger a click announcement.
if (virtualView.TapGestureRecognizerNeedsActionClick())
src/Controls/src/Core/Platform/Android/Extensions/SemanticExtensions.cs:19
- Ensure that setting the ClassName to 'android.widget.Button' does not override any pre-existing accessibility configurations, especially if multiple accessibility properties are applied.
if (virtualView.TapGestureRecognizerNeedsButtonAnnouncement())
jsuarezruiz
approved these changes
Mar 17, 2025
rmarinho
approved these changes
Mar 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR allows android tap gestures to be announced as buttons by the screenreader similar to how iOS operates. This PR is related to #28388.
There was already logic to announce "double tap to activate" when a tap gesture required just one primary press. This PR keeps that logic but also adds the "button" to be announced for any tap gesture recognizer.
The Maui Controls Sample page for TapGestureRecognizers showcases this well:
android3.mp4
Issues Fixed
Partially fixes: #26913 and #26895