[PS-1080] Added text alternative to Boolean custom field icon (#2000)

* PS-1080 Added new accessibility text property to the custom field bool icon

* PS-1080 Added BoolValue property to the FieldView and added new AccessibilityProperty to bool icon
This commit is contained in:
aj-rosado 2022-07-21 09:53:39 +01:00 committed by GitHub
parent f809170c51
commit 263aeef030
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -571,6 +571,8 @@
IsVisible="{Binding IsLinkedType}" />
<controls:IconLabel
Text="{Binding ValueText, Mode=OneWay}"
AutomationProperties.IsInAccessibleTree="true"
AutomationProperties.Name="{Binding ValueAccessibilityText, Mode=OneWay}"
StyleClass="box-value"
Grid.Row="1"
Grid.Column="0"

View file

@ -727,6 +727,7 @@ namespace Bit.App.Pages
additionalPropertyNames: new string[]
{
nameof(ValueText),
nameof(ValueAccessibilityText),
nameof(IsBooleanType),
nameof(IsHiddenType),
nameof(IsTextType),
@ -750,7 +751,7 @@ namespace Bit.App.Pages
{
if (IsBooleanType)
{
return _field.Value == "true" ? BitwardenIcons.CheckSquare : BitwardenIcons.Square;
return _field.BoolValue ? BitwardenIcons.CheckSquare : BitwardenIcons.Square;
}
else if (IsLinkedType)
{
@ -764,6 +765,19 @@ namespace Bit.App.Pages
}
}
public string ValueAccessibilityText
{
get
{
if (IsBooleanType)
{
return _field.BoolValue ? AppResources.Enabled : AppResources.Disabled;
}
return ValueText;
}
}
public FormattedString ColoredHiddenValue => PasswordFormatter.FormatPassword(_field.Value);
public Command ToggleHiddenValueCommand { get; set; }

View file

@ -19,5 +19,6 @@ namespace Bit.Core.Models.View
public string MaskedValue => Value != null ? "••••••••" : null;
public bool NewField { get; set; }
public LinkedIdType? LinkedId { get; set; }
public bool BoolValue => bool.TryParse(Value, out var b) && b;
}
}