Fix missing TalkBack labels on Card Browser filter checkboxes by GuTS805 · Pull Request #21422 · ankidroid/Anki-Android · GitHub
Skip to content

Fix missing TalkBack labels on Card Browser filter checkboxes - #21422

Merged
david-allison merged 1 commit into
ankidroid:mainfrom
GuTS805:fix/browser-filter-checkbox-a11y
Aug 7, 2026
Merged

Fix missing TalkBack labels on Card Browser filter checkboxes#21422
david-allison merged 1 commit into
ankidroid:mainfrom
GuTS805:fix/browser-filter-checkbox-a11y

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 contentDescription to the row's label in FlagsBottomSheetFragment.kt and
CardStateBottomSheetFragment.kt's onBindViewHolder, matching the existing pattern already
used in BrowserColumnSelectionAdapter.kt for its column-toggle buttons.

How Has This Been Tested?

Added FlagsBottomSheetFragmentTest and CardStateBottomSheetFragmentTest (Robolectric), which
show the bottom sheet, bind the first row, and assert the checkbox's contentDescription matches
the visible label text. Both tests were confirmed failing before the fix (contentDescription was
null) and passing after. Also ran the full com.ichi2.anki.browser.* test package with no
regressions.

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 sets contentDescription
on its equivalent per-row toggle for the same reason.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Fixes #21421

@david-allison david-allison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers! One issue with the copyright headers, and a test improvement which will also make it easier to verify the functionality

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto!

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Aug 7, 2026
@GuTS805
GuTS805 force-pushed the fix/browser-filter-checkbox-a11y branch from 806d841 to 5d89a85 Compare August 7, 2026 21:23
@GuTS805
GuTS805 requested a review from david-allison August 7, 2026 21:28
@david-allison

Copy link
Copy Markdown
Member

@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

@GuTS805

GuTS805 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@david-allison wait i'll take a look.

@GuTS805
GuTS805 force-pushed the fix/browser-filter-checkbox-a11y branch from 5d89a85 to 19a9afc Compare August 7, 2026 21:58
@GuTS805

GuTS805 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Oh, sorry @david-allison. It was on me. I committed to the wrong branch. Thanks for correcting me

@david-allison

Copy link
Copy Markdown
Member

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.
@GuTS805
GuTS805 force-pushed the fix/browser-filter-checkbox-a11y branch from 19a9afc to ad8e787 Compare August 7, 2026 22:10
@david-allison
david-allison enabled auto-merge August 7, 2026 22:19
@david-allison
david-allison added this pull request to the merge queue Aug 7, 2026
Merged via the queue into ankidroid:main with commit 8bcfce1 Aug 7, 2026
20 checks passed
@github-actions github-actions Bot removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Aug 7, 2026
@github-actions github-actions Bot added this to the 2.25 release milestone Aug 7, 2026
@GuTS805
GuTS805 deleted the fix/browser-filter-checkbox-a11y branch August 7, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card Browser filter bottom sheets (Flags / Card State) have unlabeled checkboxes for TalkBack users

2 participants