Commit 8618df06 authored by Katie D's avatar Katie D Committed by Commit Bot

Labels must be updated for accessibility after text changes.

Bug: 885326
Change-Id: I19764f67b871577d2b8e206800526508bc784fd8
Reviewed-on: https://chromium-review.googlesource.com/1245118Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594610}
parent 8299bdfb
...@@ -188,6 +188,7 @@ void DateView::UpdateTextInternal(const base::Time& now) { ...@@ -188,6 +188,7 @@ void DateView::UpdateTextInternal(const base::Time& now) {
BaseDateTimeView::UpdateTextInternal(now); BaseDateTimeView::UpdateTextInternal(now);
date_label_->SetText(l10n_util::GetStringFUTF16( date_label_->SetText(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now))); IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now)));
date_label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
} }
void DateView::OnSystemClockCanSetTimeChanged(bool can_set_time) { void DateView::OnSystemClockCanSetTimeChanged(bool can_set_time) {
...@@ -237,6 +238,8 @@ void TimeView::UpdateTextInternal(const base::Time& now) { ...@@ -237,6 +238,8 @@ void TimeView::UpdateTextInternal(const base::Time& now) {
now, model_->hour_clock_type(), base::kDropAmPm); now, model_->hour_clock_type(), base::kDropAmPm);
horizontal_label_->SetText(current_time); horizontal_label_->SetText(current_time);
horizontal_label_->SetTooltipText(base::TimeFormatFriendlyDate(now)); horizontal_label_->SetTooltipText(base::TimeFormatFriendlyDate(now));
horizontal_label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged,
true);
// Calculate vertical clock layout labels. // Calculate vertical clock layout labels.
size_t colon_pos = current_time.find(base::ASCIIToUTF16(":")); size_t colon_pos = current_time.find(base::ASCIIToUTF16(":"));
...@@ -250,6 +253,10 @@ void TimeView::UpdateTextInternal(const base::Time& now) { ...@@ -250,6 +253,10 @@ void TimeView::UpdateTextInternal(const base::Time& now) {
vertical_label_hours_->SetText(hour); vertical_label_hours_->SetText(hour);
vertical_label_minutes_->SetText(minute); vertical_label_minutes_->SetText(minute);
vertical_label_hours_->NotifyAccessibilityEvent(
ax::mojom::Event::kTextChanged, true);
vertical_label_minutes_->NotifyAccessibilityEvent(
ax::mojom::Event::kTextChanged, true);
Layout(); Layout();
} }
......
...@@ -112,6 +112,7 @@ void DateView::Update() { ...@@ -112,6 +112,7 @@ void DateView::Update() {
label_->SetText(l10n_util::GetStringFUTF16( label_->SetText(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now))); IDS_ASH_STATUS_TRAY_DATE, FormatDayOfWeek(now), FormatDate(now)));
SetAccessibleName(TimeFormatFriendlyDateAndTime(now)); SetAccessibleName(TimeFormatFriendlyDateAndTime(now));
label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true); NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
} }
...@@ -219,6 +220,9 @@ void BatteryView::Update() { ...@@ -219,6 +220,9 @@ void BatteryView::Update() {
percentage_->SetVisible(!percentage_text.empty()); percentage_->SetVisible(!percentage_text.empty());
separator_->SetVisible(!percentage_text.empty() && !status_text.empty()); separator_->SetVisible(!percentage_text.empty() && !status_text.empty());
status_->SetVisible(!status_text.empty()); status_->SetVisible(!status_text.empty());
percentage_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
status_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged, true);
} }
void BatteryView::ConfigureLabel(views::Label* label) { void BatteryView::ConfigureLabel(views::Label* 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