[iOS] Add accessibility hint for unit sheet
This CL adds accessibility hint to the buttons displaying menus in unit
conversion sheet.
Bug: 1504239
Change-Id: I0532495afeeedc0a603ef136ba2a5ecb689a1e26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5093895
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Elmehdi Rahmaoui <erahmaoui@google.com>
Cr-Commit-Position: refs/heads/main@{#1235693}
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd
index ce74150..aa12c14 100644
--- a/ios/chrome/app/strings/ios_strings.grd
+++ b/ios/chrome/app/strings/ios_strings.grd
@@ -5664,6 +5664,12 @@
<message name="IDS_IOS_WIDGET_PROMO_INSTRUCTIONS_STEP_4" desc="Fourth step of the instructions for the Password Manager widget's installation.">
Select Password Manager, then tap Add Widget
</message>
+ <message name="IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_TYPE_SELECTOR" desc="Accessibility Hint for the unit conversion title button that displays a menu of unit types. This is spoken by VoiceOver. [Length:Unlimited] [iOS only]">
+ Unit type selector
+ </message>
+ <message name="IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_SELECTOR" desc="Accessibility Hint for the unit conversion source and target unit buttons that display a menu of units. This is spoken by VoiceOver. [Length:Unlimited] [iOS only]">
+ Unit selector
+ </message>
<message name="IDS_UNITS_MEASUREMENTS_AREA" desc="Title of the button that allows the user to use and convert area type units" meaning="Button menu entry that allows the user to change the unit category to Area.">
Area
</message>
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_SELECTOR.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_SELECTOR.png.sha1
new file mode 100644
index 0000000..b62b725
--- /dev/null
+++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_SELECTOR.png.sha1
@@ -0,0 +1 @@
+8bc6f6cdd3399f799f40c3e28371afa13f158e0e
\ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_TYPE_SELECTOR.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_TYPE_SELECTOR.png.sha1
new file mode 100644
index 0000000..43a9fdc8
--- /dev/null
+++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_TYPE_SELECTOR.png.sha1
@@ -0,0 +1 @@
+31db9400cf634aa5697895ba2730715a332725a7
\ No newline at end of file
diff --git a/ios/chrome/browser/ui/unit_conversion/unit_conversion_view_controller.mm b/ios/chrome/browser/ui/unit_conversion/unit_conversion_view_controller.mm
index a898d7a4..52d18d0 100644
--- a/ios/chrome/browser/ui/unit_conversion/unit_conversion_view_controller.mm
+++ b/ios/chrome/browser/ui/unit_conversion/unit_conversion_view_controller.mm
@@ -350,6 +350,8 @@
UIMenu* menu = [UIMenu menuWithChildren:menuItemsArray];
unitTypeTitleButton.menu = menu;
+ unitTypeTitleButton.accessibilityHint = l10n_util::GetNSString(
+ IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_TYPE_SELECTOR);
unitTypeTitleButton.showsMenuAsPrimaryAction = YES;
[unitTypeTitleButton sizeToFit];
return unitTypeTitleButton;
@@ -484,6 +486,8 @@
UnitTypeCell* cell =
[tableView dequeueReusableCellWithIdentifier:kUnitTypeCellIdentifier];
cell.unitMenuButton.menu = [self unitsMenuAtSection:indexPath.section];
+ cell.unitMenuButton.accessibilityHint = l10n_util::GetNSString(
+ IDS_IOS_UNITS_MEASUREMENTS_ACCESSIBILITY_HINT_UNIT_SELECTOR);
cell.unitMenuButton.showsMenuAsPrimaryAction = YES;
NSString* unitMenuButtonTitle;
if (indexPath.section == kSourceSection) {