Commit 1497a3e0 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Add accessibility label to suggestions with tab switch button

For suggestions with a tab switch button, advertise the ability to tab
over to it and press enter, in the accessibility label.

Bug: 780835, 853911, 853929
Change-Id: I91649d0517ab6e75970e49b5358e7d210c914071
Reviewed-on: https://chromium-review.googlesource.com/1106706Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575283}
parent 1e4aad11
...@@ -106,8 +106,12 @@ base::string16 AutocompleteMatchType::ToAccessibilityLabel( ...@@ -106,8 +106,12 @@ base::string16 AutocompleteMatchType::ToAccessibilityLabel(
*label_prefix_length = 0; *label_prefix_length = 0;
int message = message_ids[match.type]; int message = message_ids[match.type];
if (!message) if (!message) {
return match_text; if (!match.has_tab_match)
return match_text;
else
return l10n_util::GetStringFUTF16(IDS_ACC_TAB_SWITCH_SUFFIX, match_text);
}
const base::string16 sentinal = const base::string16 sentinal =
base::WideToUTF16(kAccessibilityLabelPrefixEndSentinal); base::WideToUTF16(kAccessibilityLabelPrefixEndSentinal);
...@@ -159,9 +163,14 @@ base::string16 AutocompleteMatchType::ToAccessibilityLabel( ...@@ -159,9 +163,14 @@ base::string16 AutocompleteMatchType::ToAccessibilityLabel(
l10n_util::GetStringFUTF16(message, sentinal)); l10n_util::GetStringFUTF16(message, sentinal));
} }
return has_description const base::string16 base_message =
? l10n_util::GetStringFUTF16(message, match_text, description) has_description
: l10n_util::GetStringFUTF16(message, match_text); ? l10n_util::GetStringFUTF16(message, match_text, description)
: l10n_util::GetStringFUTF16(message, match_text);
if (!match.has_tab_match)
return base_message;
else
return l10n_util::GetStringFUTF16(IDS_ACC_TAB_SWITCH_SUFFIX, base_message);
} }
// static // static
......
...@@ -87,4 +87,8 @@ ...@@ -87,4 +87,8 @@
<message name="IDS_ACC_AUTOCOMPLETE_N_OF_M" desc="Text for screenreaders describing the current matche's position in the list of suggestions."> <message name="IDS_ACC_AUTOCOMPLETE_N_OF_M" desc="Text for screenreaders describing the current matche's position in the list of suggestions.">
<ph name="FRIENDLY_MATCH_TEXT">$1<ex>The Chromium Projects http://www.chromium.org bookmark</ex></ph>, <ph name="MATCH_POSITION">$2<ex>2</ex></ph> of <ph name="NUM_MATCHES">$3<ex>3</ex></ph> <ph name="FRIENDLY_MATCH_TEXT">$1<ex>The Chromium Projects http://www.chromium.org bookmark</ex></ph>, <ph name="MATCH_POSITION">$2<ex>2</ex></ph> of <ph name="NUM_MATCHES">$3<ex>3</ex></ph>
</message> </message>
<!-- Accessibility suffix for suggestions with a tab switch match. Comma is important. -->
<message name="IDS_ACC_TAB_SWITCH_SUFFIX" desc="Suffix for tab switch suggestions to explain keystroke used to switch.">
<ph name="TAB_SWITCH_SUFFIX">$1, currently open, press tab then enter to switch to the open tab</ph>
</message>
</grit-part> </grit-part>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment