Commit 4340a8b6 authored by Azeem Arshad's avatar Azeem Arshad Committed by Commit Bot

[Network Settings] Improve ARIA string for cellular summary item button.

This CL changes the aria string for network summary item button so that
it includes the device type and network display name in cases where the
button directly opens a detail page to give more context.

Bug: 1011003
Change-Id: I8c83cf03d8fdbca58955f66aa88c5aec0ff32184
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910862
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714790}
parent e5d6962e
......@@ -2416,6 +2416,9 @@
<message name="IDS_SETTINGS_INTERNET_LOOKING_FOR_MOBILE_NETWORK" desc="Text shown when viewing the Mobile data page when there are no cellular or tether networks available.">
Looking for a mobile network. <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>Learn more<ph name="END_LINK">&lt;/a&gt;</ph>
</message>
<message name="IDS_SETTINGS_INTERNET_SUMMARY_BUTTON_ACCESSIBILITY_LABEL" desc="Accessibility only label for network summary item button that opens network details.">
<ph name="NETWORK_TYPE">$1<ex>Mobile Data</ex></ph> - <ph name="NETWORK_DISPLAY_NAME">$2<ex>Verizon Wireless</ex></ph>
</message>
<message name="IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DIALOG_TITLE" desc="Settings > Internet > Tether Connection Dialog > Title asking the user to create a new hotspot.">
Connect to new hotspot?
</message>
......
......@@ -336,15 +336,24 @@ Polymer({
*/
getDetailsA11yString_: function(
activeNetworkState, deviceState, networkStateList) {
let a11yString = this.getNetworkTypeString_(deviceState.type);
// If the item opens a network detail page directly then also include the
// network display name in the A11y string to give more context.
if (!this.shouldShowSubpage_(deviceState, networkStateList)) {
let displayName;
if (activeNetworkState.guid) {
return OncMojo.getNetworkStateDisplayName(activeNetworkState);
displayName = OncMojo.getNetworkStateDisplayName(activeNetworkState);
} else if (networkStateList.length > 0) {
displayName = OncMojo.getNetworkStateDisplayName(networkStateList[0]);
}
if (networkStateList.length > 0) {
return OncMojo.getNetworkStateDisplayName(networkStateList[0]);
// Display name could be same as network type string. Only combine the
// two strings if we have a valid display name.
if (displayName !== undefined && displayName != a11yString) {
a11yString = this.i18n(
'internetSummaryButtonA11yLabel', a11yString, displayName);
}
}
return this.getNetworkTypeString_(deviceState.type);
return a11yString;
},
/**
......
......@@ -1472,6 +1472,8 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
{"internetMobileSearching", IDS_SETTINGS_INTERNET_MOBILE_SEARCH},
{"internetNoNetworks", IDS_SETTINGS_INTERNET_NO_NETWORKS},
{"internetPageTitle", IDS_SETTINGS_INTERNET},
{"internetSummaryButtonA11yLabel",
IDS_SETTINGS_INTERNET_SUMMARY_BUTTON_ACCESSIBILITY_LABEL},
{"internetToggleMobileA11yLabel",
IDS_SETTINGS_INTERNET_TOGGLE_MOBILE_ACCESSIBILITY_LABEL},
{"internetToggleTetherLabel", IDS_SETTINGS_INTERNET_TOGGLE_TETHER_LABEL},
......
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