Commit f0095ab0 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Add a11y strings for Grid/Group launch candidate

TBR=yusufo@chromium.org

Bug: 1111942, 1117205
Change-Id: I636e872b04cada76f39601b6400327fd96c20636
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376454Reviewed-by: default avatarYue Zhang <yuezhanggg@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Mei Liang <meiliang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802832}
parent aec7b139
...@@ -297,6 +297,18 @@ Still reading? ...@@ -297,6 +297,18 @@ Still reading?
<!-- crbug.com/1114311 remove this line and the following line after the bug is resolved --> <!-- crbug.com/1114311 remove this line and the following line after the bug is resolved -->
<ignore regexp="The resource `R.string.languages_set_application_language_prompt` appears to be unused"/> <ignore regexp="The resource `R.string.languages_set_application_language_prompt` appears to be unused"/>
<ignore regexp="The resource `R.string.languages_set_as_application_language` appears to be unused"/> <ignore regexp="The resource `R.string.languages_set_as_application_language` appears to be unused"/>
<!-- crbug.com/1111942 remove this line and following 11 lines after the bug is resolved -->
<ignore regexp="The resource `R.string.accessibility_tab_switcher` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_close_tab_group_button` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_close_tab_group_button_with_group_name` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_expand_tab_group_with_group_name` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_tab_selection_editor_back_button` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_tab_selection_editor` appears to be unused"/>
<ignore regexp="The resource `R.plurals.accessibility_tab_selection_dialog_remove_button` appears to be unused"/>
<ignore regexp="The resource `R.plurals.accessibility_dialog_back_button` appears to be unused"/>
<ignore regexp="The resource `R.plurals.accessibility_dialog_back_button_with_group_name` appears to be unused"/>
<ignore regexp="The resource `R.string.tab_grid_dialog_toolbar_edit_group_name` appears to be unused"/>
<ignore regexp="The resource `R.string.accessibility_tab_grid_dialog` appears to be unused"/>
<!-- Old-style and new-style WebAPKs use same resources for simplicity. Old-style WebAPKs do <!-- Old-style and new-style WebAPKs use same resources for simplicity. Old-style WebAPKs do
not use R.style.SplashTheme but new-style WebAPKs do. not use R.style.SplashTheme but new-style WebAPKs do.
TODO(crbug.com/971254): Remove suppression once old-style WebAPKs are deprecated. --> TODO(crbug.com/971254): Remove suppression once old-style WebAPKs are deprecated. -->
......
...@@ -1339,8 +1339,11 @@ class TabListMediator { ...@@ -1339,8 +1339,11 @@ class TabListMediator {
String title = getLatestTitleForTab(pseudoTab); String title = getLatestTitleForTab(pseudoTab);
title = title.equals(pseudoTab.getTitle(mTitleProvider)) ? "" : title; title = title.equals(pseudoTab.getTitle(mTitleProvider)) ? "" : title;
model.set(TabProperties.CONTENT_DESCRIPTION_STRING, model.set(TabProperties.CONTENT_DESCRIPTION_STRING,
mContext.getString(R.string.accessibility_expand_tab_group, title, title.isEmpty() ? mContext.getString(R.string.accessibility_expand_tab_group,
String.valueOf(numOfRelatedTabs))); String.valueOf(numOfRelatedTabs))
: mContext.getString(
R.string.accessibility_expand_tab_group_with_group_name,
title, String.valueOf(numOfRelatedTabs)));
} else { } else {
model.set(TabProperties.CONTENT_DESCRIPTION_STRING, null); model.set(TabProperties.CONTENT_DESCRIPTION_STRING, null);
} }
......
...@@ -214,6 +214,15 @@ ...@@ -214,6 +214,15 @@
<message name="IDS_TABSWITCHER_CREATE_GROUP" desc="This flat button is shown in the Tab Switcher, under an open tab. When the user taps the button, Chrome creates a new group of tabs that includes the existing tab. It's okay to use any of the following verbs in order to keep the text under 45 characters: Create, Make, Add."> <message name="IDS_TABSWITCHER_CREATE_GROUP" desc="This flat button is shown in the Tab Switcher, under an open tab. When the user taps the button, Chrome creates a new group of tabs that includes the existing tab. It's okay to use any of the following verbs in order to keep the text under 45 characters: Create, Make, Add.">
Create group Create group
</message> </message>
<message name="IDS_ACCESSIBILITY_TAB_SWITCHER" desc="Accessibility string for Tab Switcher view. This string is announced when the Tab Switcher is shown to screen.">
Tab Switcher
</message>
<message name="IDS_ACCESSIBILITY_CLOSE_TAB_GROUP_BUTTON" desc="The accessibility text to read when the close button on a card representing a tab group is focused in grid tab switcher. When this close button is tapped, all tabs within the tab group will be closed. NUMBER_OF_TABS is the number of tabs within this group. Note that there are always at least two tabs in a group so plural form should always be used.">
Close tab group with <ph name="NUMBER_OF_TABS">%1$s<ex>2</ex></ph> tabs
</message>
<message name="IDS_ACCESSIBILITY_CLOSE_TAB_GROUP_BUTTON_WITH_GROUP_NAME" desc="The accessibility text to read when the close button on a card representing a tab group is focused in grid tab switcher. When this close button is tapped, all tabs within the tab group will be closed. TITLE_OF_GROUP is the title of the group. NUMBER_OF_TABS is the number of tabs within this group. Note that there are always at least two tabs in a group so plural form should always be used.">
Close <ph name="TITLE_OF_GROUP">%1$s<ex>shopping</ex></ph> group with <ph name="NUMBER_OF_TABS">%1$s<ex>2</ex></ph> tabs
</message>
<!-- Tab Selection Editor strings --> <!-- Tab Selection Editor strings -->
<message name="IDS_TAB_SELECTION_EDITOR_GROUP" desc="This text button is shown in the Tab Selection Editor Toolbar. 'Group' is a verb. When the user taps the button, Chrome creates a new group that contains the selected tabs."> <message name="IDS_TAB_SELECTION_EDITOR_GROUP" desc="This text button is shown in the Tab Selection Editor Toolbar. 'Group' is a verb. When the user taps the button, Chrome creates a new group that contains the selected tabs.">
...@@ -228,6 +237,12 @@ ...@@ -228,6 +237,12 @@
other {Group <ph name="TABS_COUNT_MANY">%1$d<ex>8</ex></ph> selected tabs} other {Group <ph name="TABS_COUNT_MANY">%1$d<ex>8</ex></ph> selected tabs}
} }
</message> </message>
<message name="IDS_ACCESSIBILITY_TAB_SELECTION_EDITOR_BACK_BUTTON" desc="Accessibility string for the back button in the Tab Selection Editor Toolbar. Tap this button to exit out of the multi-select mode">
Hide multi-select mode
</message>
<message name="IDS_ACCESSIBILITY_TAB_SELECTION_EDITOR" desc="Accessibility string for Tab Selection Editor view. This string is announced when the Tab Selection Editor is shown to screen.">
Multi-select mode
</message>
<!-- Tab Grid Dialog strings --> <!-- Tab Grid Dialog strings -->
<message name="IDS_TAB_GRID_DIALOG_REMOVE_FROM_GROUP" desc="This text shows on the ungroup bar in TabGridDialog. When user drags a tab and drops it on the ungroup bar, this tab will be moved out of the group."> <message name="IDS_TAB_GRID_DIALOG_REMOVE_FROM_GROUP" desc="This text shows on the ungroup bar in TabGridDialog. When user drags a tab and drops it on the ungroup bar, this tab will be moved out of the group.">
...@@ -242,11 +257,38 @@ ...@@ -242,11 +257,38 @@
<message name="IDS_TAB_GRID_DIALOG_TOOLBAR_SHARE_GROUP" desc="This text shows in the TabGridDialog toolbar menu as one menu item. When user selects this item, the share sheet will show which allows user to share current tab group via Gmail, Messages or copy to clipboard etc, in the format of a list of URLs representing the current tab group."> <message name="IDS_TAB_GRID_DIALOG_TOOLBAR_SHARE_GROUP" desc="This text shows in the TabGridDialog toolbar menu as one menu item. When user selects this item, the share sheet will show which allows user to share current tab group via Gmail, Messages or copy to clipboard etc, in the format of a list of URLs representing the current tab group.">
Share group Share group
</message> </message>
<message name="IDS_TAB_GRID_DIALOG_TOOLBAR_EDIT_GROUP_NAME" desc="This text shows in the TabGridDialog toolbar menu as one menu item. When user selects this item, the group name field will be focused and the keyboard will show for users to edit the group name.">
Edit group name
</message>
<!-- Tab Grid Dialog accessibility strings --> <!-- Tab Grid Dialog accessibility strings -->
<message name="IDS_ACCESSIBILITY_EXPAND_TAB_GROUP" desc="The accessibility text to read when a card representing a tab group is clicked in grid tab switcher. TITLE_OF_GROUP is the title of the group. Note that TITLE_OF_GROUP can be an empty string. NUMBER_OF_TABS is the number of tabs within this group. Note that there are always at least two tabs in a group so plural form should always be used."> <message name="IDS_ACCESSIBILITY_EXPAND_TAB_GROUP" desc="The accessibility text to read when a card representing a tab group is clicked in grid tab switcher. NUMBER_OF_TABS is the number of tabs within this group. Note that there are always at least two tabs in a group so plural form should always be used.">
Expand tab group with <ph name="NUMBER_OF_TABS">%1$s<ex>2</ex></ph> tabs.
</message>
<message name="IDS_ACCESSIBILITY_EXPAND_TAB_GROUP_WITH_GROUP_NAME" desc="The accessibility text to read when a card representing a tab group is clicked in grid tab switcher. TITLE_OF_GROUP is the title of the group. NUMBER_OF_TABS is the number of tabs within this group. Note that there are always at least two tabs in a group so plural form should always be used.">
Expand <ph name="TITLE_OF_GROUP">%1$s<ex>Shopping cart</ex></ph> tab group with <ph name="NUMBER_OF_TABS">%2$s<ex>2</ex></ph> tabs. Expand <ph name="TITLE_OF_GROUP">%1$s<ex>Shopping cart</ex></ph> tab group with <ph name="NUMBER_OF_TABS">%2$s<ex>2</ex></ph> tabs.
</message> </message>
<message name="IDS_ACCESSIBILITY_TAB_SELECTION_DIALOG_REMOVE_BUTTON" desc="The accessibility text to read when the 'Remove' text button in the selection mode toolbar is focused. When this button is tapped, all the selected tabs will be removed out of the existed group and become single tab(s).">
{TABS_COUNT, plural,
=1 {Remove <ph name="TABS_COUNT_ONE">%1$d<ex>1</ex></ph> selected tab from group.}
other {Remove <ph name="TABS_COUNT_MANY">%1$d<ex>8</ex></ph> selected tabs from group.}
}
</message>
<message name="IDS_ACCESSIBILITY_DIALOG_BACK_BUTTON" desc="The accessibility text to read when the back button in the dialog is focused. When this button is tapped, the dialog will be hidden. NUMBER_OF_TABS is the number of tabs within this group. Note that after collapsing with one tab, that group becomes a tab.">
{TABS_COUNT, plural,
=1 {Collapse <ph name="TABS_COUNT_ONE">%1$d<ex>1</ex></ph> tab.}
other {Collapse tab group with <ph name="TABS_COUNT_MANY">%1$d<ex>2</ex></ph> tabs.}
}
</message>
<message name="IDS_ACCESSIBILITY_DIALOG_BACK_BUTTON_WITH_GROUP_NAME" desc="The accessibility text to read when the back button in the dialog is focused. When this button is tapped, the dialog will be hidden. TITLE_OF_GROUP is the title of the group. NUMBER_OF_TABS is the number of tabs within this group. Note that after collapsing with one tab, that group becomes a tab.">
{TABS_COUNT, plural,
=1 {Collapse <ph name="TABS_COUNT_ONE">%1$d<ex>1</ex></ph> tab.}
other {Collapse <ph name="TITLE_OF_GROUP">%1$s<ex>Shopping cart</ex></ph> tab group with <ph name="TABS_COUNT_MANY">%2$d<ex>2</ex></ph> tabs.}
}
</message>
<message name="IDS_ACCESSIBILITY_TAB_GRID_DIALOG" desc="Accessibility string for Tab Grid Dialog view. This string is announced when the dialog with tab group is expanded and shown to screen.">
Tab group expanded
</message>
<!-- Tab Grid Drag-and-drop IPH strings --> <!-- Tab Grid Drag-and-drop IPH strings -->
<message name="IDS_IPH_DRAG_AND_DROP_INTRODUCTION" desc="This text shows on the entry point for the in-product help for drag-and-drop. It introduces that this IPH is about how to use drag-and-drop."> <message name="IDS_IPH_DRAG_AND_DROP_INTRODUCTION" desc="This text shows on the entry point for the in-product help for drag-and-drop. It introduces that this IPH is about how to use drag-and-drop.">
......
9373a6f14ca83217bbf7669ab57ebaa4ced1f122 99aa12bd842183a15b8b3ab923845ad5ab922463
\ No newline at end of file \ No newline at end of file
...@@ -843,7 +843,7 @@ public class TabGridDialogTest { ...@@ -843,7 +843,7 @@ public class TabGridDialogTest {
// Verify the initial content description. // Verify the initial content description.
RecyclerView recyclerView = cta.findViewById(R.id.tab_list_view); RecyclerView recyclerView = cta.findViewById(R.id.tab_list_view);
View firstItem = recyclerView.findViewHolderForAdapterPosition(0).itemView; View firstItem = recyclerView.findViewHolderForAdapterPosition(0).itemView;
String targetString = "Expand tab group with 3 tabs."; String targetString = "Expand tab group with 3 tabs.";
assertEquals(targetString, firstItem.getContentDescription()); assertEquals(targetString, firstItem.getContentDescription());
// Content description should update with group title. // Content description should update with group title.
......
...@@ -1397,14 +1397,8 @@ public class TabListMediatorUnitTest { ...@@ -1397,14 +1397,8 @@ public class TabListMediatorUnitTest {
@Features.EnableFeatures({TAB_GROUPS_CONTINUATION_ANDROID}) @Features.EnableFeatures({TAB_GROUPS_CONTINUATION_ANDROID})
public void updateTabGroupTitle_GTS() { public void updateTabGroupTitle_GTS() {
setUpForTabGroupOperation(TabListMediatorType.TAB_SWITCHER); setUpForTabGroupOperation(TabListMediatorType.TAB_SWITCHER);
doAnswer(invocation -> { setUpTabGroupCardDescriptionString();
String title = invocation.getArgument(1); String targetString = "Expand tab group with 2 tabs.";
String num = invocation.getArgument(2);
return String.format("Expand %s tab group with %s tabs.", title, num);
})
.when(mContext)
.getString(anyInt(), anyString(), anyString());
String targetString = "Expand tab group with 2 tabs.";
assertThat(mModel.get(POSITION1).model.get(TabProperties.TITLE), equalTo(TAB1_TITLE)); assertThat(mModel.get(POSITION1).model.get(TabProperties.TITLE), equalTo(TAB1_TITLE));
// Mock that tab1 and newTab are in the same group and group root id is TAB1_ID. // Mock that tab1 and newTab are in the same group and group root id is TAB1_ID.
...@@ -2209,17 +2203,12 @@ public class TabListMediatorUnitTest { ...@@ -2209,17 +2203,12 @@ public class TabListMediatorUnitTest {
} }
@Test @Test
@Features.EnableFeatures({TAB_GROUPS_CONTINUATION_ANDROID})
public void testTabDescriptionStringSetup() { public void testTabDescriptionStringSetup() {
setUpForTabGroupOperation(TabListMediatorType.TAB_SWITCHER); setUpForTabGroupOperation(TabListMediatorType.TAB_SWITCHER);
// Setup the string template. // Setup the string template.
doAnswer(invocation -> { setUpTabGroupCardDescriptionString();
String title = invocation.getArgument(1); String targetString = "Expand tab group with 2 tabs.";
String num = invocation.getArgument(2);
return String.format("Expand %s tab group with %s tabs.", title, num);
})
.when(mContext)
.getString(anyInt(), anyString(), anyString());
String targetString = "Expand tab group with 2 tabs.";
// Setup a tab group with {tab2, tab3}. // Setup a tab group with {tab2, tab3}.
List<Tab> tabs = new ArrayList<>(); List<Tab> tabs = new ArrayList<>();
...@@ -2242,6 +2231,30 @@ public class TabListMediatorUnitTest { ...@@ -2242,6 +2231,30 @@ public class TabListMediatorUnitTest {
equalTo(false)); equalTo(false));
assertThat(mModel.get(POSITION2).model.get(TabProperties.CONTENT_DESCRIPTION_STRING), assertThat(mModel.get(POSITION2).model.get(TabProperties.CONTENT_DESCRIPTION_STRING),
equalTo(targetString)); equalTo(targetString));
// Set group name.
targetString = String.format("Expand %s tab group with 2 tabs.", CUSTOMIZED_DIALOG_TITLE1);
mMediator.getTabGroupTitleEditor().storeTabGroupTitle(TAB2_ID, CUSTOMIZED_DIALOG_TITLE1);
mMediator.getTabGroupTitleEditor().updateTabGroupTitle(mTab2, CUSTOMIZED_DIALOG_TITLE1);
assertThat(mModel.get(POSITION2).model.get(TabProperties.CONTENT_DESCRIPTION_STRING),
equalTo(targetString));
}
private void setUpTabGroupCardDescriptionString() {
doAnswer(invocation -> {
String title = invocation.getArgument(1);
String num = invocation.getArgument(2);
return String.format("Expand %s tab group with %s tabs.", title, num);
})
.when(mContext)
.getString(anyInt(), anyString(), anyString());
doAnswer(invocation -> {
String num = invocation.getArgument(1);
return String.format("Expand tab group with %s tabs.", num);
})
.when(mContext)
.getString(anyInt(), anyString());
} }
private void initAndAssertAllProperties() { private void initAndAssertAllProperties() {
......
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