Skip to content

Commit

Permalink
[BottomAppBar][Catalog][a11y] Request focus on search menu when showing
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 470727992
  • Loading branch information
paulfthomas authored and imhappi committed Aug 29, 2022
1 parent 6e6c53a commit 968e035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -18,6 +18,7 @@

import io.material.catalog.R;

import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -184,6 +185,7 @@ private void setUpBottomAppBarShapeAppearance() {
babBackground.getShapeAppearanceModel().toBuilder().setTopEdge(topEdge).build());
}

@SuppressLint("NewApi")
protected void setUpBottomDrawer(View view) {
View bottomDrawer = coordinatorLayout.findViewById(R.id.bottom_drawer);
bottomDrawerBehavior = BottomSheetBehavior.from(bottomDrawer);
Expand All @@ -193,6 +195,7 @@ protected void setUpBottomDrawer(View view) {
v -> bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED));
bar.setNavigationIcon(R.drawable.ic_drawer_menu_24px);
bar.replaceMenu(R.menu.demo_primary);
bar.getMenu().findItem(R.id.menu_search).getActionView().requestFocus();
}

private void showSnackbar(CharSequence text) {
Expand Down
Expand Up @@ -18,6 +18,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_search_24px"
android:title="@string/cat_bottomappbar_search"
app:showAsAction="ifRoom"/>
Expand Down

0 comments on commit 968e035

Please sign in to comment.