[PS-676] Accessibility - "Options" expand/collapse control does not announce state (#1925)

* PS-676: Accessibility - "Options" expand/collapse control does not announce state
- Moved to click event to the stacklayout
- Added accessibility text to stacklayout
- Removed accessibility on views inside stacklayout

* PS-676 Changed event to command

Co-authored-by: André Bispo <abispo@bitwarden.com>
This commit is contained in:
André Filipe da Silva Bispo 2022-05-27 14:52:19 +01:00 committed by GitHub
parent 9a2b6c8ec9
commit 5bbef3ee16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 12 deletions

View file

@ -2,6 +2,7 @@
<pages:BaseContentPage <pages:BaseContentPage
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="Bit.App.Pages.SendAddEditPage" x:Class="Bit.App.Pages.SendAddEditPage"
xmlns:pages="clr-namespace:Bit.App.Pages" xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:u="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
@ -252,28 +253,31 @@
</StackLayout> </StackLayout>
<StackLayout <StackLayout
Orientation="Horizontal" Orientation="Horizontal"
Spacing="0"> Spacing="0"
xct:TouchEffect.Command="{Binding ToggleOptionsCommand}"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{Binding OptionsAccessilibityText}">
<Button <Button
Text="{u:I18n Options}" Text="{u:I18n Options}"
x:Name="_btnOptions" x:Name="_btnOptions"
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
Margin="0" Margin="0"
Clicked="ToggleOptions_Clicked"/> AutomationProperties.IsInAccessibleTree="False"/>
<controls:IconButton <controls:IconButton
x:Name="_btnOptionsUp" x:Name="_btnOptionsUp"
Text="{Binding Source={x:Static core:BitwardenIcons.ChevronUp}}" Text="{Binding Source={x:Static core:BitwardenIcons.ChevronUp}}"
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
Clicked="ToggleOptions_Clicked" IsVisible="{Binding ShowOptions}"
IsVisible="{Binding ShowOptions}" /> AutomationProperties.IsInAccessibleTree="False"/>
<controls:IconButton <controls:IconButton
x:Name="_btnOptionsDown" x:Name="_btnOptionsDown"
Text="{Binding Source={x:Static core:BitwardenIcons.AngleDown}}" Text="{Binding Source={x:Static core:BitwardenIcons.AngleDown}}"
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
Clicked="ToggleOptions_Clicked" IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}"
IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}" /> AutomationProperties.IsInAccessibleTree="False"/>
</StackLayout> </StackLayout>
<StackLayout IsVisible="{Binding ShowOptions}"> <StackLayout IsVisible="{Binding ShowOptions}">
<StackLayout <StackLayout

View file

@ -209,11 +209,6 @@ namespace Bit.App.Pages
} }
} }
private void ToggleOptions_Clicked(object sender, EventArgs e)
{
_vm.ToggleOptions();
}
private void ClearExpirationDate_Clicked(object sender, EventArgs e) private void ClearExpirationDate_Clicked(object sender, EventArgs e)
{ {
if (DoOnce()) if (DoOnce())

View file

@ -61,6 +61,7 @@ namespace Bit.App.Pages
_logger = ServiceContainer.Resolve<ILogger>("logger"); _logger = ServiceContainer.Resolve<ILogger>("logger");
TogglePasswordCommand = new Command(TogglePassword); TogglePasswordCommand = new Command(TogglePassword);
ToggleOptionsCommand = new Command(ToggleOptions);
TypeOptions = new List<KeyValuePair<string, SendType>> TypeOptions = new List<KeyValuePair<string, SendType>>
{ {
@ -91,6 +92,7 @@ namespace Bit.App.Pages
} }
public Command TogglePasswordCommand { get; set; } public Command TogglePasswordCommand { get; set; }
public Command ToggleOptionsCommand { get; set; }
public string SendId { get; set; } public string SendId { get; set; }
public int SegmentedButtonHeight { get; set; } public int SegmentedButtonHeight { get; set; }
public int SegmentedButtonFontSize { get; set; } public int SegmentedButtonFontSize { get; set; }
@ -104,6 +106,7 @@ namespace Bit.App.Pages
public bool DisableHideEmailControl { get; set; } public bool DisableHideEmailControl { get; set; }
public bool IsAddFromShare { get; set; } public bool IsAddFromShare { get; set; }
public string ShareOnSaveText => CopyInsteadOfShareAfterSaving ? AppResources.CopySendLinkOnSave : AppResources.ShareOnSave; public string ShareOnSaveText => CopyInsteadOfShareAfterSaving ? AppResources.CopySendLinkOnSave : AppResources.ShareOnSave;
public string OptionsAccessilibityText => ShowOptions ? AppResources.OptionsExpanded : AppResources.OptionsCollapsed;
public List<KeyValuePair<string, SendType>> TypeOptions { get; } public List<KeyValuePair<string, SendType>> TypeOptions { get; }
public List<KeyValuePair<string, string>> DeletionTypeOptions { get; } public List<KeyValuePair<string, string>> DeletionTypeOptions { get; }
public List<KeyValuePair<string, string>> ExpirationTypeOptions { get; } public List<KeyValuePair<string, string>> ExpirationTypeOptions { get; }
@ -136,7 +139,11 @@ namespace Bit.App.Pages
public bool ShowOptions public bool ShowOptions
{ {
get => _showOptions; get => _showOptions;
set => SetProperty(ref _showOptions, value); set => SetProperty(ref _showOptions, value,
additionalPropertyNames: new[]
{
nameof(OptionsAccessilibityText)
});
} }
public int ExpirationDateTypeSelectedIndex public int ExpirationDateTypeSelectedIndex
{ {

View file

@ -3935,6 +3935,18 @@ namespace Bit.App.Resources {
} }
} }
public static string OptionsExpanded {
get {
return ResourceManager.GetString("OptionsExpanded", resourceCulture);
}
}
public static string OptionsCollapsed {
get {
return ResourceManager.GetString("OptionsCollapsed", resourceCulture);
}
}
public static string UppercaseAtoZ { public static string UppercaseAtoZ {
get { get {
return ResourceManager.GetString("UppercaseAtoZ", resourceCulture); return ResourceManager.GetString("UppercaseAtoZ", resourceCulture);

View file

@ -2202,6 +2202,12 @@
<data name="ReportCrashLogsDescription" xml:space="preserve"> <data name="ReportCrashLogsDescription" xml:space="preserve">
<value>Help Bitwarden improve app stability by allowing crash reports.</value> <value>Help Bitwarden improve app stability by allowing crash reports.</value>
</data> </data>
<data name="OptionsExpanded" xml:space="preserve">
<value>Options are expanded, tap to collapse.</value>
</data>
<data name="OptionsCollapsed" xml:space="preserve">
<value>Options are collapsed, tap to expand.</value>
</data>
<data name="UppercaseAtoZ" xml:space="preserve"> <data name="UppercaseAtoZ" xml:space="preserve">
<value>Uppercase (A to Z)</value> <value>Uppercase (A to Z)</value>
</data> </data>