From 98130e89de006a92289c753028cf094b6af87f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Filipe=20da=20Silva=20Bispo?= Date: Wed, 1 Jun 2022 20:50:19 +0100 Subject: [PATCH] PS-689 Android: Accessibility - back buttons in search and vault > bin lack appropriate accessible name (#1929) * PS-689 Added back buttons accessibility text * PS-689 Changed resource key from "GoBack" to "TapToGoBack" * PS-689: class rename --- src/Android/Android.csproj | 1 + src/Android/Renderers/CustomPageRenderer.cs | 31 +++++++++++++++++++++ src/App/Pages/Vault/CiphersPage.xaml | 4 ++- src/App/Resources/AppResources.Designer.cs | 6 ++++ src/App/Resources/AppResources.resx | 3 ++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/Android/Renderers/CustomPageRenderer.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index f03f2776e..94691d6a3 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -150,6 +150,7 @@ + diff --git a/src/Android/Renderers/CustomPageRenderer.cs b/src/Android/Renderers/CustomPageRenderer.cs new file mode 100644 index 000000000..5dec9821a --- /dev/null +++ b/src/Android/Renderers/CustomPageRenderer.cs @@ -0,0 +1,31 @@ +using System; +using Android.App; +using Android.Content; +using AndroidX.AppCompat.Widget; +using Bit.App.Resources; +using Bit.Droid.Renderers; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportRenderer(typeof(ContentPage), typeof(CustomPageRenderer))] +namespace Bit.Droid.Renderers +{ + public class CustomPageRenderer : PageRenderer + { + public CustomPageRenderer(Context context) : base(context) + { + } + + protected override void OnElementChanged(ElementChangedEventArgs e) + { + base.OnElementChanged(e); + + Activity context = (Activity)this.Context; + var toolbar = context.FindViewById(Resource.Id.toolbar); + if(toolbar != null) + { + toolbar.NavigationContentDescription = AppResources.TapToGoBack; + } + } + } +} diff --git a/src/App/Pages/Vault/CiphersPage.xaml b/src/App/Pages/Vault/CiphersPage.xaml index d9a31fa53..8b463e1a3 100644 --- a/src/App/Pages/Vault/CiphersPage.xaml +++ b/src/App/Pages/Vault/CiphersPage.xaml @@ -33,7 +33,9 @@ Text="" VerticalOptions="CenterAndExpand" Clicked="BackButton_Clicked" - x:Name="_backButton" /> + x:Name="_backButton" + AutomationProperties.IsInAccessibleTree="True" + AutomationProperties.Name="{u:I18n TapToGoBack}"/> Special Characters (!@#$%^&*) + + Tap to go back + Password is visible, tap to hide.