0

I have a simple TabbedView with three tab icons at the bottom that show up nicely in iOS.

However, I am not satisfied with the VoiceOver text it generates for people with vision problems. It says the following:

  • "Tab Bar Page 1 One Of Three"
  • "Tab Bar Page 2 Two Of Three"
  • "Tab Bar Page 3 Three Of Three"

I would like to make it more friendly and I would like it to say:

  • "Test 1"
  • "Test 2"
  • "Test 3"

I tried to achieve that with the standard AutomationProperties.Name attribute I'm using everywhere else in the app but it gets completely ignored for the TabbedPage:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:mypages="clr-namespace:radio;assembly=radio" 
             x:Class="radio.MainPage">

    <NavigationPage Title="Page 1" IconImageSource="icon_1.png" AutomationProperties.Name="Test 1" >
        <x:Arguments>
            <mypages:PageArchive />
        </x:Arguments>
    </NavigationPage>

    <mypages:PagePlayer Title="Page 2" IconImageSource="icon_2.png" AutomationProperties.Name="Test 2" />

    <mypages:PageAboutXaml Title="Page 3" IconImageSource="icon_3.png"  AutomationProperties.Name="Test 3"/>

</TabbedPage>

Any ideas what can be wrong?

adamsfamily
  • 1,746
  • 19
  • 37
  • I think that is nothing wrong. It is just how it works. According to the [Automation properties](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/accessibility/automation-properties). Some elements are read differently than others, and this also depends on the software used for that :/ – Juan Sturla Oct 01 '21 at 10:09
  • For all other entities I was able to customize the VoiceOver text (making it more friendly to the user). In the TabbedPage the problem is when it comes to foreign languages, the original built-in text doesn't make sense, it sounds like "Tab bed Page 2 One forward-slash Three" - it really sounds awkward. I'm hoping to be able to override it. – adamsfamily Oct 01 '21 at 16:03

1 Answers1

0

Try to set custom accessibilityLabel on tabBarItem .

We need to create custom renderer to achieve that .

[assembly: ExportRenderer(typeof(TabbedPage), typeof(MyRenderer))]
namespace FormsApp.iOS
{
    public class MyRenderer : TabbedRenderer
    { 
        public override void ViewWillLayoutSubviews()
        {
            base.ViewWillLayoutSubviews();
            int index = 1;
            foreach (var vc in ViewControllers)
            {
               vc.TabBarItem.AccessibilityLabel = "Test" + index.ToString();
               index++;
            }            
        }  
    }
}

Refer to https://stackoverflow.com/a/26368487/8187800 .

ColeX
  • 14,062
  • 5
  • 43
  • 240
  • Thanks for your effort, I used exactly the code above but it still says "TabBar Test1 one of three". If I change "test" to "x x" it does reflect the change so I'm sure the code does have an effect, it just doesn't get rid of the text around the tab item's name. – adamsfamily Oct 04 '21 at 11:04
  • Did you try to enable `isAccessibilityElement` an set `accessibilityIdentifier ` as mentioned in this link : https://stackoverflow.com/a/49437988/8187800 ? – ColeX Oct 05 '21 at 09:00
  • I tried to set all of the following attributes `AccessibilityLabel`, `IsAccessibilityElement`, `AccessibilityIdentifier`, `AccessibilityValue`, `AccessibilityTextualContext` - but it didn't help getting rid of the 'Tab Tar' - 'Tab' - ... text around the name of the tab. – adamsfamily Oct 06 '21 at 18:22
  • sorry,I tried all ways but no luck , maybe you need to custom a tab layout to replace the default one, also I suggest you raise this issue on [Apple Developer forum](https://developer.apple.com/forums/) for better support . – ColeX Oct 11 '21 at 07:29
  • Actually I would suggest you not do that. Vision impaired people need the context, i.e. what tab they are on and how many tabs there are. This will help them navigate more easily. In general it is best to use the device defaults for accessibility as sight impaired users get used to the format and context of screen reader messages. If, in your example, the tab only said "Test 1" the use would have no idea how many tabs their are, or which tab number they are on. I would also make sure you involve a sight impaired person as what seems "friendly" to you may not seem "friendly" to them. – ColeX Oct 14 '21 at 02:47