Fix missing TalkBack labels on Check Pronunciation play/record buttons (#21443) by GuTS805 · Pull Request #21451 · ankidroid/Anki-Android · GitHub
Skip to content

Fix missing TalkBack labels on Check Pronunciation play/record buttons (#21443) - #21451

Merged
criticalAY merged 1 commit into
ankidroid:mainfrom
GuTS805:fix/check-pronunciation-a11y-21443
Aug 10, 2026
Merged

Fix missing TalkBack labels on Check Pronunciation play/record buttons (#21443)#21451
criticalAY merged 1 commit into
ankidroid:mainfrom
GuTS805:fix/check-pronunciation-a11y-21443

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The play, cancel and record CardViews in view_audio_play.xml and view_audio_record.xml (New Study
Screen's Check Pronunciation feature) didnt have any contentDescription, so TalkBack wasnt
announcing anything for them. reused the existing string resources (play_recording, dialog_cancel,
record_voice, replay_voice) instead of adding new ones, and updated
AudioPlayView.changePlayIcon() so it also switches the description between Play/Replay depending
on which icon state its in.

verified with mutation testing that if you remove the description update it actually breaks the
test, so its a real regression guard not just a happy path check.

Fixes #21443

Purpose / Description

the "Check Pronunciation" feature in New Study Screen (the play/cancel/record buttons) had no
contentDescription set on any of its buttons, so TalkBack user gets literally nothing when they
focus on it. theres an old issue #16320 thats basically the exact same bug, but that one was for
the OLD version of this screen and its already fixed. this feature got rewritten completely in
2025 for New Study Screen and somehow the same gap came back cus its all new files this time

Approach

added android:contentDescription to play_button/cancel_button in view_audio_play.xml and to
recordButton in view_audio_record.xml, reusing strings that already existed (play_recording,
dialog_cancel, record_voice) instead of making new ones. the play button icon changes between play
and replay depending on state so i also updated changePlayIcon() in AudioPlayView.kt to update the
contentDescription along with the icon, otherwise itd just say "Play" forever even when its
actually showing replay

How Has This Been Tested?

wrote AudioPlayViewTest and AudioRecordViewTest (robolectric) that check contentDescription on
each button including when it switches to replay state. all 4 tests failed first (before fix,
contentDescription was null) then passed after i added the fix. also did a mutation test - removed
the description-setting line again on purpose and confirmed the test caught it, then put it back.
ran the whole com.ichi2.anki.ui.windows.reviewer.* package after and nothing broke

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

The play, cancel, and record CardViews in view_audio_play.xml and view_audio_record.xml
(New Study Screen's Check Pronunciation feature) had no contentDescription, so TalkBack
announced nothing for them. Reused existing string resources (play_recording, dialog_cancel,
record_voice, replay_voice) and updated AudioPlayView.changePlayIcon() to switch the
description between Play/Replay based on icon state.

Verified via mutation testing that removing the description update breaks the test.

Fixes ankidroid#21443
@github-actions

Copy link
Copy Markdown
Contributor

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Aug 10, 2026

@criticalAY criticalAY left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool!

@criticalAY criticalAY added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Aug 10, 2026
@criticalAY
criticalAY added this pull request to the merge queue Aug 10, 2026
@GuTS805

GuTS805 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Merged via the queue into ankidroid:main with commit 57f68bb Aug 10, 2026
20 checks passed
@github-actions github-actions Bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Aug 10, 2026
@GuTS805
GuTS805 deleted the fix/check-pronunciation-a11y-21443 branch August 10, 2026 22:45
@github-actions github-actions Bot added this to the 2.25 release milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Check Pronunciation" record/play buttons in the New Study Screen have no contentDescription for TalkBack

3 participants