Commit 46c65f1d authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Improve undo closed tab accessibility

This CL adds accessibility announcement for the undone closed tab
action. This announcement is announced after user has pressed the undo
button in the snackbar under GTS or the reopen button under the
accessibility tab switcher.

Skip-Translation-Screenshots-Check: True
Bug: 526259
Change-Id: I18ef6ab8e606f27d6dab609a8a37757b4d20556e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518102
Commit-Queue: Mei Liang <meiliang@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823698}
parent ec659ce7
......@@ -384,6 +384,9 @@ public class AccessibilityTabModelListItem extends FrameLayout implements OnClic
}
} else if (v == mUndoButton) {
// Kill the close action.
String undoButtonOnClickAnnouncement = mUndoButton.getContext().getString(
R.string.accessibility_undo_closed_tab_announcement_message, mTab.getTitle());
mUndoButton.announceForAccessibility(undoButtonOnClickAnnouncement);
mHandler.removeCallbacks(mCloseRunnable);
mListener.cancelPendingClosure(tabId);
......
......@@ -176,7 +176,9 @@ public class UndoBarController implements SnackbarManager.SnackbarController {
mSnackbarManagable.getSnackbarManager().showSnackbar(
Snackbar.make(content, this, Snackbar.TYPE_ACTION, Snackbar.UMA_TAB_CLOSE_UNDO)
.setTemplateText(mContext.getString(R.string.undo_bar_close_message))
.setAction(mContext.getString(R.string.undo), tabId));
.setAction(mContext.getString(R.string.undo), tabId)
.setActionAccessibilityAnnouncement(
getUndoneAccessibilityAnnouncement(content, false)));
}
/**
......@@ -195,7 +197,18 @@ public class UndoBarController implements SnackbarManager.SnackbarController {
isAllTabs ? Snackbar.UMA_TAB_CLOSE_ALL_UNDO
: Snackbar.UMA_TAB_CLOSE_MULTIPLE_UNDO)
.setTemplateText(mContext.getString(R.string.undo_bar_close_all_message))
.setAction(mContext.getString(R.string.undo), closedTabs));
.setAction(mContext.getString(R.string.undo), closedTabs)
.setActionAccessibilityAnnouncement(
getUndoneAccessibilityAnnouncement(content, true)));
}
private String getUndoneAccessibilityAnnouncement(String content, boolean isMultiple) {
return isMultiple
? mContext.getString(
R.string.accessibility_undo_multiple_closed_tabs_announcement_message,
content)
: mContext.getString(
R.string.accessibility_undo_closed_tab_announcement_message, content);
}
/**
......
......@@ -1877,6 +1877,12 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
<message name="IDS_ACCESSIBILITY_TAB_SWITCHER_UNDO_TAB_CLOSED" desc="Content description for the undo tab closed 'button.">
Reopen closed tab
</message>
<message name="IDS_ACCESSIBILITY_UNDO_CLOSED_TAB_ANNOUNCEMENT_MESSAGE" desc="Message spoken out loud for accessibility when a user decides to undo a closed tab.">
Restored <ph name="TAB_TITLE">%1$s<ex>YouTube</ex></ph>, tab
</message>
<message name="IDS_ACCESSIBILITY_UNDO_MULTIPLE_CLOSED_TABS_ANNOUNCEMENT_MESSAGE" desc="Message spoken out loud for accessibility when a user decides to undo multiple closed tabs at once.">
Restored <ph name="TAB_COUNT">%1$s<ex>3</ex></ph> tabs
</message>
<message name="IDS_ACCESSIBILITY_TABSTRIP_TAB" desc="Content description for the tab title.">
<ph name="TAB_TITLE">%1$s<ex>Welcome to Facebook</ex></ph>, tab
</message>
......
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