Skip to content

[media-ui]Centralize volume button accessibility semantics in VolumeScreen - #2742

Merged
yschimke merged 6 commits into
google:mainfrom
dianastefan12:fix-volume-accessibility
Jul 29, 2026
Merged

[media-ui]Centralize volume button accessibility semantics in VolumeScreen#2742
yschimke merged 6 commits into
google:mainfrom
dianastefan12:fix-volume-accessibility

Conversation

@dianastefan12

Copy link
Copy Markdown
Contributor

WHAT

Centralize volume button accessibility semantics inside VolumeScreen by wrapping increaseIcon and decreaseIcon in containers with explicit button semantics (clearAndSetSemantics).

WHY

Screen readers (TalkBack) were not consistently announcing or triggering actions on the volume increase and decrease controls in VolumeScreen. Explicitly setting accessibility semantics (contentDescription, Role.Button, and onClick actions) directly on the volume button slots ensures reliable accessibility interaction across Wear OS devices.

HOW

  • Wrapped the increaseIcon and decreaseIcon slots in Stepper inside Box layout containers.
  • Applied Modifier.clearAndSetSemantics to the icon boxes to configure:
    • contentDescription mapped to string resources (horologist_volume_screen_volume_up_content_description and horologist_volume_screen_volume_down_content_description).
    • role = Role.Button to indicate button behavior to accessibility services.
    • onClick action handlers executing increaseVolume() and decreaseVolume().

Checklist 📋

  • Add explicit visibility modifier and explicit return types for public declarations
  • Run spotless check
  • Run tests
  • Update metalava's signature text files

@google-cla

google-cla Bot commented Jul 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dianastefan12

Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@dianastefan12
dianastefan12 force-pushed the fix-volume-accessibility branch from e030efe to 60951cc Compare July 17, 2026 11:46
@yschimke

Copy link
Copy Markdown
Collaborator

Is this a Wear Compose bug? Should we fix there? or is there a tracking bug?

@yschimke
yschimke requested a review from kul3r4 July 20, 2026 10:55
@kul3r4

kul3r4 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

@dianastefan12 did you also ran the media sample to confirm behaviour when talk back is enabled?

@dianastefan12

Copy link
Copy Markdown
Contributor Author

Is this a Wear Compose bug? Should we fix there? or is there a tracking bug?

Here is the bug: https://b.corp.google.com/issues/512233745

@dianastefan12

Copy link
Copy Markdown
Contributor Author

@dianastefan12 did you also ran the media sample to confirm behaviour when talk back is enabled?

Tested manually:

Test Case 1: TalkBack Accessibility Focus & Role Announcement
Open the Volume Control Screen in the Media Controller.
Move TalkBack focus to the Volume Up (+) icon:
Expected Result: TalkBack announces "Increase Volume, Button" and displays the green TalkBack focus indicator rectangle around the icon container.
Move TalkBack focus to the Volume Down (-) icon:
Expected Result: TalkBack announces "Decrease volume, Button" and displays the green TalkBack focus indicator rectangle around the icon container.

Test Case 2: Double-Tap Interaction under TalkBack Focus
Place TalkBack focus on the Volume Up (+) button and double-tap on the button:
Expected Result: Volume increases by one step. TalkBack announces the updated volume percentage (e.g., "50 percent" via live region update).
Move TalkBack focus to the Volume Down (-) button and double-tap on the buttton:
Expected Result: Volume decreases by one step. TalkBack announces the updated volume percentage.

dianastefan12 and others added 3 commits July 28, 2026 19:25
Removed role = Role.Button inside clearAndSetSemantics for both increaseIcon and decreaseIcon slots so only the outer Stepper button container provides the button role:
…ix-volume-accessibility

# Conflicts:
#	media/audio-ui-material3/src/main/java/com/google/android/horologist/audio/ui/material3/VolumeScreen.kt
#	media/audio-ui/src/main/java/com/google/android/horologist/audio/ui/VolumeScreen.kt
@yschimke
yschimke enabled auto-merge (squash) July 29, 2026 09:34
@yschimke
yschimke merged commit 4f765a3 into google:main Jul 29, 2026
11 checks passed
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.

3 participants