Commit c6ebdd26 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Limit network change announcements in ChromeVox

This change:
- reports network changes
- does not report signal changes on the same network name
- splits the connection status string into
name (e.g. connected to foobar)
description (e.g. weak signal)
which are more semantically meaningful for ChromeVox
- omits hints for ChromeVox alerts

Bug: 955815
Change-Id: I0972026772a2f523af51a9c77016d6ec47818ab9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614123
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660975}
parent 3fb50708
......@@ -56,7 +56,8 @@ const char* NetworkTrayView::GetClassName() const {
}
void NetworkTrayView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->SetName(connection_status_string_);
node_data->SetName(accessible_name_);
node_data->SetDescription(accessible_description_);
node_data->role = ax::mojom::Role::kButton;
}
......@@ -120,9 +121,8 @@ void NetworkTrayView::UpdateConnectionStatus(
bool notify_a11y) {
using SignalStrength = network_icon::SignalStrength;
base::string16 new_connection_status_string;
if (connected_network) {
new_connection_status_string = l10n_util::GetStringFUTF16(
base::string16 new_accessible_name = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_CONNECTED,
base::UTF8ToUTF16(connected_network->name()));
......@@ -148,28 +148,31 @@ void NetworkTrayView::UpdateConnectionStatus(
break;
}
accessible_description_ = signal_strength_string;
if (!signal_strength_string.empty()) {
new_connection_status_string = l10n_util::GetStringFUTF16(
connection_status_tooltip_ = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_CONNECTED_ACCESSIBLE,
base::UTF8ToUTF16(connected_network->name()),
signal_strength_string);
} else {
// Use shorter description like "Disconnected" instead of "disconnected
// from network" for the tooltip, because the visual icon tells that
// this is about the network status.
connection_status_tooltip_ = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_DISCONNECTED_TOOLTIP);
}
} else {
accessible_description_.clear();
}
connection_status_tooltip_ = new_connection_status_string;
} else {
new_connection_status_string = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_NOT_CONNECTED_A11Y);
// Use shorter desription like "Disconnected" instead of "disconnected from
// netrowk" for the tooltip, because the visual icon tells that this is
// about the network status.
connection_status_tooltip_ = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_DISCONNECTED_TOOLTIP);
}
if (new_connection_status_string != connection_status_string_) {
connection_status_string_ = new_connection_status_string;
if (notify_a11y && !connection_status_string_.empty())
if (accessible_name_ == new_accessible_name)
return;
accessible_name_ = new_accessible_name;
if (notify_a11y && !accessible_name_.empty())
NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true);
image_view()->SetAccessibleName(connection_status_string_);
}
}
......
......@@ -67,7 +67,8 @@ class NetworkTrayView : public TrayItemView,
void UpdateConnectionStatus(const chromeos::NetworkState* connected_network,
bool notify_a11y);
base::string16 connection_status_string_;
base::string16 accessible_name_;
base::string16 accessible_description_;
base::string16 connection_status_tooltip_;
std::unique_ptr<TrayNetworkStateObserver> network_state_observer_;
......
......@@ -2046,6 +2046,10 @@ Output.prototype = {
if (!this.enableHints_ || localStorage['useVerboseMode'] != 'true')
return;
// No hints for alerts, which can be targeted at controls.
if (type == EventType.ALERT)
return;
// Hints are not yet specialized for braille.
if (this.formatOptions_.braille)
return;
......
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