I've built a Xamarin Android app based on the Xamarin AppShell template in VS. The hamburger button which invokes the flyout gets announced by the TalkBack screen reader as having a name of "OK". This doesn't seem a good match for the purpose of the button, perhaps a name of "Menu" would be more helpful. I've not found a way to change the AutomationProperties.Name of the hamburger button.
How can I change the hamburger button such that TalkBack announces it as the "Menu" button?
CodePudding user response:
I'm not familiar with Xamarin but with basic Android coding, you'd use android:contentDescription
to specify the text you want the screen reader (Talkback) to announce.
contentDescription
is also mentioned in https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/accessibility
CodePudding user response:
In the Android, there is a property named toolbar.NavigationContentDescription for the hamburger button in the app shell. You can set it by a custom shell renderer.
custom shell renderer :https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/customrenderers
And set the property
public class MyShellToolbarAppearanceTracker : ShellToolbarAppearanceTracker
{
public MyShellToolbarAppearanceTracker(IShellContext context) : base(context)
{
}
public override void SetAppearance(Toolbar toolbar, IShellToolbarTracker toolbarTracker, ShellAppearance appearance)
{
base.SetAppearance(toolbar, toolbarTracker, appearance);
// I had debug the value of description and it's "ok".
// string description = toolbar.NavigationContentDescription;
toolbar.NavigationContentDescription = "menu";
}
}