Skip to content

Commit 43b0e46

Browse files
leticiarossiafohrman
authored andcommitted
[Catalog][TopAppBar][a11y] Fix toolbar close button not having a content description
PiperOrigin-RevId: 678362412
1 parent f141ed3 commit 43b0e46

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

catalog/java/io/material/catalog/topappbar/TopAppBarToolbarDemoFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem menuItem) {
8484

8585
private void initToolbar(View view, MaterialToolbar toolbar) {
8686
toolbar.setNavigationIcon(NAVIGATION_ICON_RES_ID);
87+
toolbar.setNavigationContentDescription(R.string.cat_topappbar_close_button);
8788
toolbar.setNavigationOnClickListener(
8889
v -> showSnackbar(view, toolbar.getSubtitle() + " " + toolbar.getTitle()));
8990
toolbar.inflateMenu(MENU_RES_ID);

catalog/java/io/material/catalog/topappbar/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
<string name="cat_topappbar_configure_centered">Centered</string>
8989
<!-- Label for a check box for configuring toolbar navigation icon [CHAR_LIMIT=NONE] -->
9090
<string name="cat_topappbar_configure_navigation_icon">Navigation Icon</string>
91+
<!-- Label for the toolbar navigation icon when it's a close button -->
92+
<string name="cat_topappbar_close_button" description="The title of the close button of the toolbar. [CHAR_LIMIT=NONE]">Close</string>
9193
<!-- Label for a check box for configuring toolbar menu items [CHAR_LIMIT=NONE] -->
9294
<string name="cat_topappbar_configure_menu_items">Menu Items</string>
9395
<!-- Label for a button to apply toolbar configurations [CHAR_LIMIT=NONE] -->

0 commit comments

Comments
 (0)