-
Notifications
You must be signed in to change notification settings - Fork 463
Implement SetSemanticFocus and Announce APIs #1727
Conversation
AutomationNotificationKind.ActionAborted, | ||
AutomationNotificationProcessing.ImportantMostRecent, | ||
text, | ||
"270FA098-C644-40A2-A0BE-A9BEA1222A1E"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move it to constants with an appropriate name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rachelkang Thanks for this❣️ can you take a look on my suggestion on for loop? I'll keep it as a comment to not block the merge (:
public static partial class SemanticExtensions | ||
{ | ||
static void PlatformSetSemanticFocus(this VisualElement element) => | ||
throw new NotSupportedException($"The current platform '{Device.RuntimePlatform}' does not support Xamarin.CommunityToolkit.SemanticExtensions"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for the future me. Create an exception helper class like essentials
// you really shouldn't be using the announce API | ||
static AutomationPeer? FindAutomationPeer(DependencyObject depObj) | ||
{ | ||
if (depObj != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we invert this if?
{ | ||
if (depObj != null) | ||
{ | ||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we cache the VisualTreeHelper.GetChildrenCount()
value? (If it doesn't change)
Description of Bug
Implements SetSemanticFocus and Announce APIs for screen reader accessibility
Future TODO: Implement Support SetSemanticFocus on Windows
Issues Fixed
Behavioral Changes
SetSemanticFocus
can be leveraged to direct the screen reader focus to a specific controlAnnounce
can be leveraged to instruct the screen reader to announce specific textPR Checklist
approved