Skip to content

fix(player): keyboard seek on the meditation player, a working muted volume slider, and playlist rows without a nested link - #298

Merged
sydevs-bot merged 7 commits into
mainfrom
claude/fix-audio-player-a11y
Nov 20, 2026
Merged

sydevs-bot merged 7 commits into
mainfrom
claude/fix-audio-player-a11y

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Visitors using a keyboard can now move through a meditation. The progress handle is a focusable slider: the arrow keys move 5s, PageUp and PageDown move 30s, Home jumps to the start and End to the end. A screen reader announces its position as a time (for example "1:05"), and keyboard focus draws the site's focus ring around it.
  • Music library volume: while the player is muted, dragging the volume slider now unmutes it and sets the level. Before, the slider snapped back to 0.
  • Music library playlist rows: the credit link (the artist's name) no longer sits inside the row's play button, so assistive technology reads two separate controls. Each row looks the same as before and still plays when clicked anywhere except the credit, which opens the credit's page. Keyboard focus on a row now draws the site's focus ring, and nothing clips it.
  • Developers: the two AudioPlayerProvider wrappers are gone (nothing ever read their context), and the core useAudioPlayer hook has its first tests.

Findings addressed

  • F8c, credit link nested in the play button (axe nested-interactive, serious; shape decided in fix(components): live pages outside the axe gate's fixtures still fail it #289). On main, PlaylistItem's <button> wrapped both the <h4> and the credit <Link>. Each row is now a relative wrapper (components/molecules/Playlist/Playlist.tsx:75) that holds two siblings:

    • an empty <button> positioned absolute inset-0, carrying aria-current and named by the <h4> through aria-labelledby (:82-87)
    • the credit <Link>, made relative so it paints above the button (:93)

    The link's stopPropagation is gone. Measured in Ladle: each row is still 448×64 and the button covers all of it. A click on the title or the duration reaches the button, and a click on the credit reaches the link.
    Tests: components/molecules/Playlist/Playlist.test.tsx, "Playlist rows — the play button and the credit link" (jsdom). It runs axe nested-interactive over a rendered Playlist, checks the link is not inside the button, checks a row click calls onTrackClick(4) for a filtered row, and checks a credit click does not play. The first two fail on main. MusicLibrary.test.tsx was adjusted for the new accessible name.

    • Review follow-up: the button draws focus-ring (Playlist.tsx:85). The list is an overflow-y-auto scroll container, and each row fills its width, so the scroll container cut off the ring's left, right and top edges. -m-1 p-1 on the list (:172) gives the ring 4px of room and leaves every row exactly where it was. Measured in a headless Chrome against the Ladle Playlist and MusicLibrary stories: the row boxes are identical with and without the two classes (for example 676,152 540×64 in MusicLibrary), and the gap between the focused button and the clip edge is 4px on the left, right and top. Pinned by the test "draws the focus ring on the play button", which fails without the class.
  • F8e, volume slider inert while muted. react-use-audio-player 4.0.2's setVolume calls howl.volume() only, which never clears mute, and the slider renders 0 while muted. PlaylistAudioPlayerControls gains unmute (components/molecules/AudioPlayer/types.ts:70-71), wired to the core hook in hooks/audio/usePlaylistAudioPlayer.ts:198. The volume slider calls setVolume and then unmute (components/molecules/AudioPlayer/AudioPlayer.tsx:183-186), the same order as MeditationPlayer's voice row.
    Tests: AudioPlayer.test.tsx "unmutes when it moves while muted" and usePlaylistAudioPlayer.test.ts "unmutes the core player". Both fail on main.

  • F8f, seek handle unreachable by keyboard. On main the handle was a <div> with only onMouseDown and onTouchStart. It is now role="slider" with tabIndex={0} (components/organisms/MeditationPlayer/MeditationPlayer.tsx:790-818). It sets:

    • aria-valuemin 0 and aria-valuemax the rounded duration
    • aria-valuenow the clamped, rounded position
    • aria-valuetext from formatDuration

    The keys come from SEEK_KEY_STEPS and seekTargetForKey (:74-90). Each key seeks through the existing handleSeek, is clamped to the track, and calls preventDefault. Other keys such as Tab and Enter pass through. The handle draws focus-ring; checked in headless Chrome, :focus-visible matches after a Tab and the ring draws around the 44×44 handle. No existing key fits the name, so aria-labelledby points at the player's visible "Meditation" label (t('meditation.general.label'), :662). A one-line shortcut: marks the swap to media.a11y.progress.
    Tests: MeditationPlayer.seek.test.tsx (jsdom) covers the named slider and its values, all 8 keys with preventDefault, clamping at both ends, and that Tab and Enter are left alone. All 12 tests fail on main.

  • F15d, no-op AudioPlayerProvider wrappers. In node_modules/[email protected]/dist/index.js, useAudioPlayer keeps its player in useRef plus useSyncExternalStore and never calls useContext. Only useAudioPlayerContext reads the context, and nothing in this repo calls it. Each provider only built one more idle player. The wrappers were removed from MeditationPlayer.tsx, MusicLibrary.tsx and AudioPlayer.stories.tsx. The doc lines in AudioPlayer.tsx, usePlaylistAudioPlayer.ts:27 and .ladle/vite.config.ts were corrected; the React dedupe that config explains is still needed. Nothing visible changes, so there is no fail-first test. The existing MusicLibrary and MeditationPlayer suites and the axe gate pass without the providers.

  • F12a, audio-hook coverage. New hooks/audio/useAudioPlayer.test.ts (jsdom, 9 tests) runs against a recorder of the library. It covers:

    • a url loads as html5 and reloads only when the url changes
    • a caller's onEnd replaces the hook's own
    • play starts one sound and resumes that same sound id; an already-playing sound is left alone
    • the library's play is used before any Howl exists
    • seek targets the started sound, updates currentTime and fires onPlaybackTimeUpdate; before a sound starts, seek falls back to the library
    • the 100ms poll runs only while playing
    • unmute passes through

    These cover existing behaviour, so they pass on main by design. useCircularProgress is left to the tests bundle.

  • Review follow-up (comments): the seek handle's 7-line comment and the step table's comment restated the code. What remains is the one gotcha (a label hidden by the wide layout still names the slider when it is referenced directly) and the one-line shortcut:.

Not in this PR

  • F8d: the music library's seek input has no name. It needs media.a11y.progress, with the wording declared upstream in feat(translations): add a name for the audio player's progress slider SahajCloud#1222 (not merged). The same key replaces the interim aria-labelledby on the meditation player's progress slider. Until it lands, a music-library target in tests/a11y/page-types.test.tsx would still fail axe label (critical) on that input. That is why F8c's fail-first test lives in Playlist.test.tsx and not in the page-types gate. Tried locally: with a temporary music target, main reported label plus nested-interactive (2 nodes); after this change only label remains.
  • F8j: an audio load failure is never shown. useAudioPlayer exposes state.error, but nothing reads it. Showing it needs a new visitor-facing string, which is not hand-added here. Needed upstream: media.general.load_error, English "This audio could not be loaded.", shown with a status or alert role by AudioPlayer (music library) and MeditationPlayer when state.error is set.

Reconciled with open PRs

git merge-tree --write-tree of this branch against every open PR branch reports no conflicts.

Test results

The lean gate (.claude/skills/pr-prep/check.sh) ran on the final head and exited 0:

  • Lint: 0 errors, 1083 warnings (main has 1084). None are on lines this branch wrote.
  • tsc --noEmit: passed.
  • Vitest: 131 files, 1246/1246 tests passed.
  • pnpm build: not run, because this bundle is not marked BUILD.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw

Each playlist row was a <button> wrapping the track's credit <Link>: one
tab stop carrying two actions, which axe reports as nested-interactive
(serious, one node per track) on /music-for-meditation. A screen reader
also heard the credit and the duration folded into the button's name.

The row is now two siblings, as #289 decided ("two tab stops rather than
one nested in the other"): a button covering the whole row, named by the
track's <h4>, and the credit link positioned above it. A click anywhere
else on the row still plays the track, the focus outline still wraps the
row, and the link no longer needs to stop the click reaching the button.

The a11y gate cannot carry this target yet: a music page there also
fails `label` on AudioPlayer's seek input, which waits on the upstream
media.a11y.progress key (SahajCloud#1222). The fail-first test is the
Playlist's own spec instead: axe nested-interactive over a rendered
Playlist, plus the row and credit clicks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
AudioPlayer's volume slider reads 0 while the player is muted and only
called setVolume when moved. Howler's volume() never clears a mute, so the
player stayed muted, the controlled input snapped back to 0, and the slider
did nothing until the listener found the mute button.

MeditationPlayer already unmutes its voice channel from the slider.
PlaylistAudioPlayerControls now exposes the core hook's idempotent unmute,
and the slider calls it after setting the volume, so moving it is enough
to make a muted playlist audible again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
…yboard

MeditationPlayer's seek handle was a <div> with only onMouseDown and
onTouchStart: no tab stop, no role and no value, so a keyboard or screen
reader user could play and pause but never move through a meditation.

The handle is now a focusable role="slider" reporting the position in
seconds (aria-valuemin/max/now) and as the player's own M:SS readout
(aria-valuetext, from formatDuration). Arrow keys move 5 seconds, PageUp
and PageDown 30, Home and End go to either end; each seeks at once and
stops the key scrolling the page. Focus draws the focus-ring utility. No
animation is added, so there is no motion to gate.

No existing key names a seek slider, and the upstream one,
media.a11y.progress (sydevs/SahajCloud#1222), has not merged. Until it
does, aria-labelledby points at the player's visible "Meditation" label —
the player draws no track title — and a shortcut comment marks the swap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
MeditationPlayer and MusicLibrary each wrapped their real component in
react-use-audio-player's AudioPlayerProvider, and the AudioPlayer story did
the same. In react-use-audio-player 4.0.2 the library's useAudioPlayer keeps
its player in a ref per call and never reads the context; only
useAudioPlayerContext does, and nothing in the repo calls it. Each provider
only built one more idle player that nothing used.

The wrappers go, each Inner component becomes the export, and the doc lines
telling a caller to use the hook inside a provider now say none is needed.
The Ladle Vite comment no longer names the provider: the React dedupe it
explains is still needed, for the library's hooks themselves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
useAudioPlayer had no test of its own: every spec that renders a player
replaces it with a recorder, so the contracts the playlist and the
meditation player lean on were asserted nowhere. This pins them against a
recorder of react-use-audio-player instead: the url option loads as html5
and reloads only on a new url, a caller's onEnd replaces the hook's, play
starts one sound and resumes that same sound rather than overlapping a
second, seek targets that sound and reports the time at once, the 100ms
poll runs only while playing, and unmute passes through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The play button now covers the whole row, and it marked keyboard focus with
nothing but the browser's default outline. It draws `focus-ring`, the
treatment docs/rules/design-system.md names for every interactive element.

The list is an `overflow-y-auto` scroll container, which clips at its
padding box, and each row fills its width: a ring 4px outside the row lost
its left, right and top edges. `p-1` gives the ring that room, and `-m-1`
keeps every row where it was. Measured in Ladle (Playlist and MusicLibrary
stories, headless Chrome): row boxes identical before and after, 4px between
the focused button and the clip edge on the left, right and top.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The block above the progress handle restated its handlers, its role and its
hit area, and the step table's comment restated what Home and End do. What
is left is the one gotcha (a hidden label still names the slider when it is
referenced directly) and a one-line `shortcut:` for the interim name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-design 4ceb592 Commit Preview URL

Branch Preview URL
Nov 19 2026, 09:12 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web 4ceb592 Commit Preview URL

Branch Preview URL
Nov 19 2026, 09:12 PM

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot

sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 23:49Z address-review · attempt 1 · session · done
  • 23:49Z address-review · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 19, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

No commits this run. Both threads are answered with evidence and left open for you to settle.

main is merged into the branch locally — 8 commits, #299 among them — with no conflicts and no file in common with this branch's 14. The lean gate passes on the merged tree: 0 lint errors, tsc clean, 1354/1354 tests across 142 files. The merge is not pushed, because pushing it alone would only re-run CI.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 19, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 20, 2026
Merged via the queue into main with commit e238e3a Nov 20, 2026
19 of 21 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-audio-player-a11y branch November 20, 2026 00:45
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 20, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
…ofix

`hooks/audio/usePlaylistAudioPlayer.test.ts` conflicted. Both sides broke the
one-line `vi.hoisted` recorder into a multi-line object: this branch for
prettier, #298 to add `unmute: vi.fn()`. Main's side carries both, so it
stands.

The 14 files main brought in need no second mechanical commit: `pnpm lint`
exits 0 on the merge as it stands.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXQQg5YdpdZ46P9pXp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants