0

I am currently attempting to add accessibility features to an mobile application written with DotNet MAUI. During the course of testing, it became evident that entry components could not be activated and the on-screen keyboard displayed under certain conditions.

Currently, our design uses a ListView in a similar manner to a collapsible - the form of a specific record is displayed upon tapping on a custom header that is displayed within the ViewCell of the ListView.

When an Entry field within a ListView is highlighted by BackTalk - Android's built-in accessability service, BackTalk prompts the user to double-tap anywhere on the screen to activate the Entry field and its keyboard. Doing so, however, does nothing.

I have attempted adding TapGestureRecognizers to entry fields, but break-points on these functions are never hit - the functions are not firing.

I have created a sample project, using the Maui project template, the code of which is here :

<!--MainPage.xaml-->

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:pageModels="clr-namespace:MauiApp2.PageModels"             
             xmlns:models="clr-namespace:MauiApp2.Models"
             xmlns:controls="clr-namespace:MauiApp2.Pages.Controls"
             x:Class="MauiApp2.Pages.MainPage"
             x:DataType="pageModels:MainPageModel"
             x:Name="OverviewPage"
             Title="{Binding Today}">

    <VerticalStackLayout>

        <!--This field can be entered properly via Androud's BackTalk -->
        <Border BackgroundColor="{DynamicResource White}" StrokeShape="RoundRectangle 5">
            <Entry Text="Good field" />
        </Border>

        <!--This field cannnot be entered properly via Android's BackTalk.-->
        <ListView ItemsSource="{Binding TodoCategoryData}" HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="models:CategoryChartData">
                    <ViewCell>
                        <Border BackgroundColor="{DynamicResource White}" StrokeShape="RoundRectangle 5">
                            <Entry Text="Bad Field">
                                <Entry.GestureRecognizers>
                                    <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
                                </Entry.GestureRecognizers>
                            </Entry>
                        </Border>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </VerticalStackLayout>
</ContentPage>
//MainPage.xaml.cs

    public partial class MainPage : ContentPage
    {
        public MainPage(MainPageModel model)
        {
            InitializeComponent();
            BindingContext = model;
        }

        
        private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
        {
            var a = 1; //a breakpoint on this line is never hit.
        }
    }
//MainPageModel.cs

    public partial class MainPageModel : ObservableObject, IProjectTaskPageModel
    {      
        public MainPageModel()
        {

        }


        //The type CategoryChartData is auto-generated by VS when creating a MAUI project.
        [ObservableProperty]
        private List<CategoryChartData> _todoCategoryData = new List<CategoryChartData>()
        {
            new CategoryChartData("hello world!", 1)
        };

        public IAsyncRelayCommand<ProjectTask> NavigateToTaskCommand => throw new NotImplementedException();

        public bool IsBusy => throw new NotImplementedException();
    }

Does anybody know of a workaround for this issue? Is there a different component I should be using? Perhaps a different approach entirely?

2
  • 1
    The ListView supports "tapping" ... it seems pointless to add a "TapGestureRecognizer" on top of that. You should start with a proof of concept that only (mostly) deals with "strings" and code behind; then move to "patterns" and data templates once that's working. Won't make any time difference. Commented Oct 22 at 17:36
  • 1
    It is bad idea to use ListView, use CollectionView instead. It is not even a thing, as it gets deprecated in a month. And you should be binding the tap command to your VM directly. Command="{Binding Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, Path=SomeRelayCommand}" Commented Oct 23 at 4:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.