diff options
| author | 2023-06-01 12:31:13 -0700 | |
|---|---|---|
| committer | 2023-06-01 19:46:39 +0000 | |
| commit | 53df240e3d4967e8ff6cb7f74a767ae800bb79ab (patch) | |
| tree | 6ae2de3e0103181e2d359f86c116ae3be39d353e | |
| parent | cf2e76555e377bbacc93b91a75afe1be0da3edfb (diff) | |
Add request for a11y focus for item
In fullscreen user switcher, when we select add, the first item on the
list is not focused in talkback. Upon inflation, we add a 200ms delayed
a11y request.
Fixes: 273874539
Test: enable talkback, go to fullscreen user switcher and go to add. The
first item "Add User" is highlighted and announced.
Change-Id: I919160ed0a03f100d1382b1da76ca2e8c2658fcb
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt b/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt index 7236e0fd134a..59f2cdb745ca 100644 --- a/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/user/ui/binder/UserSwitcherViewBinder.kt @@ -224,7 +224,7 @@ object UserSwitcherViewBinder { } sectionView.removeAllViewsInLayout() - for (viewModel in section) { + section.onEachIndexed { index, viewModel -> val view = layoutInflater.inflate( R.layout.user_switcher_fullscreen_popup_item, @@ -237,6 +237,13 @@ object UserSwitcherViewBinder { view.resources.getString(viewModel.textResourceId) view.setOnClickListener { viewModel.onClicked() } sectionView.addView(view) + // Ensure that the first item in the first section gets accessibility focus. + // Request for focus with a delay when view is inflated an added to the listview. + if (index == 0 && position == 0) { + view.postDelayed({ + view.requestAccessibilityFocus() + }, 200) + } } return sectionView } |