Fix missing TalkBack labels on Card Browser filter checkboxes - #21422
Conversation
david-allison
left a comment
There was a problem hiding this comment.
Cheers! One issue with the copyright headers, and a test improvement which will also make it easier to verify the functionality
There was a problem hiding this comment.
same note on copyright headers
| val holder = requireNotNull(recyclerView.findViewHolderForAdapterPosition(0)) | ||
| val label = holder.itemView.findViewById<TextView>(R.id.text).text | ||
| val checkbox = holder.itemView.findViewById<CheckBox>(R.id.checkbox) | ||
| assertThat(checkbox.contentDescription, equalTo(label)) |
There was a problem hiding this comment.
It would be better to assert against a fixed string, both for a more readable test, and to guard against label changes causing TalkBack regressions
|
|
||
| onView(withId(R.id.list)).inRoot(isDialog()).check { view, _ -> | ||
| val recyclerView = view as RecyclerView | ||
| val holder = requireNotNull(recyclerView.findViewHolderForAdapterPosition(0)) |
806d841 to
5d89a85
Compare
|
@GuTS805 I think GitHub is showing me an old diff, the copyright headers and strings seem unchanged. Please let me know if this is an issue on my end. I'll be around this weekend and I'm excited to get things movijg |
|
@david-allison wait i'll take a look. |
5d89a85 to
19a9afc
Compare
|
Oh, sorry @david-allison. It was on me. I committed to the wrong branch. Thanks for correcting me |
The Flags and Card State bottom sheet filters bind a per-row CheckBox without a contentDescription, so TalkBack only announces "checked" / "not checked" with no indication of which flag or state it toggles. Set contentDescription to the row's label, matching the pattern already used in BrowserColumnSelectionAdapter.
19a9afc to
ad8e787
Compare

Purpose / Description
The Flags and Card State filter bottom sheets in the Card Browser bind a per-row CheckBox
without a contentDescription. TalkBack users swiping through the list only hear "checked" /
"not checked" with no indication of which flag or card state the checkbox toggles.
Approach
Set
contentDescriptionto the row's label inFlagsBottomSheetFragment.ktandCardStateBottomSheetFragment.kt'sonBindViewHolder, matching the existing pattern alreadyused in
BrowserColumnSelectionAdapter.ktfor its column-toggle buttons.How Has This Been Tested?
Added
FlagsBottomSheetFragmentTestandCardStateBottomSheetFragmentTest(Robolectric), whichshow the bottom sheet, bind the first row, and assert the checkbox's
contentDescriptionmatchesthe visible label text. Both tests were confirmed failing before the fix (
contentDescriptionwasnull) and passing after. Also ran the fullcom.ichi2.anki.browser.*test package with noregressions.
Learning (optional, can help others)
Found by comparing the Flags/Card State filter sheets (new UI, ~2 weeks old) against the existing
accessibility pattern in
BrowserColumnSelectionAdapter, which already setscontentDescriptionon its equivalent per-row toggle for the same reason.
Checklist
Fixes #21421