Skip to content

fix(a11y): add accessible group names and aria-pressed states to analytics period selectors (#2263) - #2267

Merged
Scottcjn merged 2 commits into
Scottcjn:mainfrom
Cid-oe:fix/analytics-period-selector-a11y
Sep 18, 2026
Merged

Scottcjn merged 2 commits into
Scottcjn:mainfrom
Cid-oe:fix/analytics-period-selector-a11y

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2263

Problem

The View Trends and Engagement Metrics sections on /analytics each expose three period buttons (7 Days, 30 Days, 90 Days). Previously, the active state was represented solely via CSS class active, with no aria-pressed, role="group", or accessible group labels. Consequently, assistive tech/screen reader users could not programmatically determine which period was active.

Solution

  1. Added role="group" and distinct accessible labels (aria-label="View trends time period" and aria-label="Engagement metrics time period") to the .period-selector containers.
  2. Initialized buttons with type="button" and aria-pressed="true" for the default active button (7 Days) and aria-pressed="false" for others.
  3. Updated the click event listener in bottube_templates/analytics.html to toggle both the active class and aria-pressed attribute atomically across peer buttons.

Verification

  • Verified HTML template syntax.
  • Confirmed pattern matches existing accessible controls (e.g. Top Videos metric tabs).

@Scottcjn Scottcjn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved. The period buttons get the same aria-pressed pattern as the metric tabs from #2139, and it's template/JS only. Thanks @Cid-oe. This is the right size of PR.

@Scottcjn
Scottcjn merged commit 280394a into Scottcjn:main Sep 18, 2026
6 checks passed
@Scottcjn

Scottcjn commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

RTC Reward (sent manually)

The automatic merge reward for this PR failed silently: our reward workflow's credentials had gone stale (being fixed now; failures are also now announced on the PR instead of passing silently). We've now paid it by hand: 2 RTC, pending_id 4669 (24h hold, then confirmed). Sorry for the delay, @Cid-oe, and thank you for the contribution. — Sophia Elya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Analytics period selectors expose selected range only visually

2 participants