File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
lib/java/com/google/android/material/search Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -749,6 +749,12 @@ public Toolbar getToolbar() {
749749 return toolbar ;
750750 }
751751
752+ /** Returns the container view containing the non-scrim content of the {@link SearchView}. */
753+ @ NonNull
754+ public View getSearchContainer () {
755+ return rootView ;
756+ }
757+
752758 /** Returns the main {@link EditText} which can be used for hint and search text. */
753759 @ NonNull
754760 public EditText getEditText () {
@@ -959,6 +965,17 @@ private void updateNavigationIconProgressIfNeeded() {
959965 void requestFocusAndShowKeyboardIfNeeded () {
960966 if (autoShowKeyboard ) {
961967 requestFocusAndShowKeyboard ();
968+ } else if (!isInTouchMode ()) {
969+ // We still want to request focus if we are in non-touch mode so that focus doesn't go
970+ // behind the searchview.
971+ editText .postDelayed (
972+ () -> {
973+ if (editText .requestFocus ()) {
974+ // Workaround for talkback issue when clear button is clicked
975+ editText .sendAccessibilityEvent (AccessibilityEvent .TYPE_VIEW_FOCUSED );
976+ }
977+ },
978+ TALKBACK_FOCUS_CHANGE_DELAY_MS );
962979 }
963980 }
964981
Original file line number Diff line number Diff line change 2929 android : id =" @+id/open_search_view_root"
3030 android : layout_width =" match_parent"
3131 android : layout_height =" match_parent"
32- android : focusable =" true"
33- android : focusableInTouchMode =" true"
3432 android : touchscreenBlocksFocus =" true"
3533 android : keyboardNavigationCluster =" true"
3634 android : visibility =" gone" >
You can’t perform that action at this time.
0 commit comments