Skip to content

WEBDEV-9046: Address the ia-playback-controls review follow-ups - #102

Open
jbuckner wants to merge 1 commit into
mainfrom
WEBDEV-9046-playback-controls-followups
Open

jbuckner wants to merge 1 commit into
mainfrom
WEBDEV-9046-playback-controls-followups

Conversation

@jbuckner

Copy link
Copy Markdown
Collaborator

The four nits and coverage gaps from Neeraj's review of #80, split out at the time so they didn't hold up the radio player release.

Three of the four are what the ticket asked for. The fourth turned into a bit more: playbackRate is a public property, so an unusable value reached the screen reader as "Playback speed, currently NaN". The new formatter is the natural place to stop that, and there's already a test making the equivalent promise for volume. Rates outside the range the speed button steps through are still shown as they are, since a media element will happily play at those. Say the word if you'd rather that came out and went on its own ticket.

aria-hidden went on all ten icons rather than just the two the ticket named. The other eight are equally decorative, and ia-expandable-search-bar and ia-radio-player already do this, so this brings the component in line rather than starting something new.

Two of the tests I wrote first were vacuous, which is the exact failure this ticket exists to clean up, so it's worth saying how they're pinned down now. The locale one compared Intl output against the raw number, which are the same string in the en-US test browser; it uses a third instead, where formatting stops at three fraction digits in every locale and the raw value spells out sixteen. And the aria-hidden sweep only ever saw seven of the ten icons, since pause and the two quieter volume icons never render in the default state; it now walks the element through those states and asserts which buttons it covered.

I checked each fix by reverting it and re-running: every new test fails without the change it covers.

QA

Everything runs on the PR preview, no login needed.

Preview: https://internetarchive.github.io/elements/pr/pr-100/#elem-ia-playback-controls

Go to the playback controls demo and confirm:

✅ Only the <ia-playback-controls> demo renders.

✅ The speed button reads 1x and the volume reads 100%.

Press the speed button on the playback controls demo and confirm:

✅ It steps 1.25x, 1.5x, 1.75x, 2x, then back round to 0.5x.

✅ The decimal separator matches your browser's language. Set the browser to German and it reads 1,25x.

Set "Playback rate" to something that isn't a number in the Settings table on the playback controls demo and confirm:

✅ It shows 1x rather than NaNx.

Inspect any control button in devtools on the playback controls demo and confirm:

✅ Its <svg> carries aria-hidden="true".

🤖 Generated with Claude Code

https://claude.ai/code/session_01DaEr5YT1xpjK5ydNZPvjwx

Four items split out of the WEBDEV-8965 review so they didn't hold up
the radio player release.

Nothing covered the `color: inherit` rule on .unstyled-button. Buttons
don't inherit colour from their parent, so without it the container's
themed colour never reaches the icons and their currentColor falls back
to the UA default. There's a test for that now, driven through the
public theme variable. It skips the play/pause button on purpose, since
that one sets its own colour and would pass either way.

The decorative icons are hidden from assistive tech. Every button
carries its own aria-label, and replay and skip-ahead each contain a
<text>10</text> that gives the SVG accessible content of its own. All
ten get the attribute, matching what ia-expandable-search-bar and
ia-radio-player already do. The test walks the element through playing
and the two quieter volume states as well, because pause, volume-medium
and volume-mute never render otherwise, and it asserts which buttons it
covered so a future icon can't slip past unchecked.

MAX_PLAYBACK_RATE is documented. The one comment above the pair only
described MIN_PLAYBACK_RATE.

The playback rate goes through Intl.NumberFormat, in its own module
alongside the one ia-transcript-view already has for durations. It was
interpolated as a raw JS number, so it always formatted with a decimal
point whatever the reader's locale. The test uses a third rather than a
quarter step: formatting stops at three fraction digits in every
locale, while the raw value spells out all sixteen, so the assertion
tells the two apart without depending on the locale the tests run in.

That formatter is also where an unusable rate now stops. `playbackRate`
is public, so `NaN` could reach the display and the screen reader as
"Playback speed, currently NaN". Rates outside the range the button
steps through are left alone: a media element will still play at those.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DaEr5YT1xpjK5ydNZPvjwx
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-102/

Built to branch ghpages at 2026-09-15 00:20 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (631605d) to head (52d33c8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   85.79%   85.81%   +0.02%     
==========================================
  Files          74       75       +1     
  Lines        2619     2623       +4     
  Branches      577      578       +1     
==========================================
+ Hits         2247     2251       +4     
  Misses        195      195              
  Partials      177      177              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants