Skip to content

fix: add aria-label to icon-only activity bar buttons in playground sidebar - #535

Open
Somil450 wants to merge 1 commit into
piyushdotcomm:mainfrom
Somil450:fix/525-aria-label-icon-buttons
Open

fix: add aria-label to icon-only activity bar buttons in playground sidebar#535
Somil450 wants to merge 1 commit into
piyushdotcomm:mainfrom
Somil450:fix/525-aria-label-icon-buttons

Conversation

@Somil450

Copy link
Copy Markdown

Summary

Closes #525
Adds aria-label to the 3 icon-only activity bar buttons in PlaygroundSidebar and marks their Lucide icons as aria-hidden="true".

Problem

The Explorer, Dependencies, and Environment buttons in the playground sidebar activity bar had title attributes but no aria-label. Screen readers use aria-label (not title) to announce button names, so these buttons were announced only as "button" with zero context.

This violates WCAG 2.1 SC 4.1.2 (Name, Role, Value), a Level A requirement.

Change

// modules/playground/components/playground-sidebar.tsx

 <button
     onClick={() => setActiveTab("explorer")}
     title="Explorer"
+    aria-label="Explorer"
 >
-    <FolderOpen className="h-5 w-5" />
- +    <FolderOpen className="h-5 w-5" aria-hidden="true" />
-  </button>
 <button
     onClick={() => setActiveTab("packages")}
     title="Dependencies"
+    aria-label="Dependencies"
 >
-    <Package className="h-5 w-5" />
- +    <Package className="h-5 w-5" aria-hidden="true" />
-  </button>
 <button
     onClick={() => setActiveTab("env")}
     title="Environment"
+    aria-label="Environment Variables"
 >
-    <Server className="h-5 w-5" />
- +    <Server className="h-5 w-5" aria-hidden="true" />
-  </button>
- ```
`aria-hidden="true"` on the icons prevents double-reading: without it, some screen readers announce both the SVG title and the button label.

## Files Changed

- `modules/playground/components/playground-sidebar.tsx` - 6 lines changed

…idebar

Closes piyushdotcomm#525

The three activity bar buttons (Explorer, Dependencies, Environment)
had title attributes but no aria-label. Screen readers use aria-label,
not title, so these buttons were announced as just 'button' with no
context for screen reader users.

Also adds aria-hidden=true to the Lucide icons inside each button to
prevent double-reading (once from icon SVG, once from label).

Fixes WCAG 2.1 SC 4.1.2 (Name, Role, Value) - Level A.
@Somil450
Somil450 requested a review from piyushdotcomm as a code owner July 31, 2026 09:12
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Somil450, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fd91469b-21fa-46fc-b818-5df8053fb7f1

📥 Commits

Reviewing files that changed from the base of the PR and between 4ffe26f and 8137fbe.

📒 Files selected for processing (1)
  • modules/playground/components/playground-sidebar.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Jul 31, 2026
@github-actions

Copy link
Copy Markdown

👋 Thanks for opening a PR, @Somil450!

Your PR has entered the 🚦 PR Review Pipeline.

Standard PR detected — your PR will follow the standard review pipeline.


What happens next

Stage Reviewer Checks
Stage 1 — Automated Validation 🤖 Bot DCO · Format · AI/Slop · Duplicate
Stage 2 — Human Review 👥 Maintainer Code + Quality Review
Stage 3 — PA / Maintainer Review 🔑 Project Admin Final Merge Decision

A pipeline status comment will appear below and update automatically as your PR progresses.


While you wait

  • Sign all commits (git commit -s)
  • Link your issue (Closes #123)
  • Use a feature branch (not main)
  • Avoid unrelated changes

This comment is posted only once.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix a11y: add aria-labels to icon-only playground sidebar buttons

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add accessible names to icon-only activity bar buttons via aria-label.
• Mark decorative Lucide icons aria-hidden to prevent double announcements.
• Fix WCAG 2.1 SC 4.1.2 (Name, Role, Value) for screen reader users.
Diagram

graph TD
  A["PlaygroundSidebar"] --> B["Activity bar buttons"] --> C{{"Screen readers"}}
  B --> D["Lucide icons"] --> E["aria-hidden=true"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Create a shared IconOnlyButton component
  • ➕ Enforces aria-label + aria-hidden defaults across the app
  • ➕ Prevents regressions when adding new icon-only buttons
  • ➖ Adds abstraction for a small localized need
  • ➖ May require design/API decisions (tooltip/title behavior, sizes, variants)
2. Drive buttons from a config array (label + tab + Icon)
  • ➕ Reduces repetition and makes labels/icons harder to desync
  • ➕ Simplifies adding future activity bar items
  • ➖ Slightly more indirection for a short component
  • ➖ Not necessary unless more buttons are expected
3. Prefer aria-labelledby with visually-hidden text
  • ➕ Single source of truth for visible tooltip text and accessible name
  • ➕ Allows richer accessible names than attributes alone
  • ➖ More markup and styling (sr-only spans)
  • ➖ Overkill when a stable aria-label is sufficient

Recommendation: The current approach (aria-label on the button + aria-hidden on decorative icons) is the most direct, standards-aligned fix for icon-only controls. Consider extracting a shared IconOnlyButton only if similar patterns exist elsewhere or are likely to be introduced.

Files changed (1) +6 / -3

Bug fix (1) +6 / -3
playground-sidebar.tsxAdd aria-labels and hide icons from accessibility tree +6/-3

Add aria-labels and hide icons from accessibility tree

• Adds aria-label attributes to the Explorer, Dependencies, and Environment activity bar buttons so screen readers announce meaningful names. Marks the Lucide SVG icons as aria-hidden to avoid duplicate announcements in some assistive technologies.

modules/playground/components/playground-sidebar.tsx

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 22 rules

Grey Divider


Informational

1. Tooltip/label mismatch 🐞 Bug ⚙ Maintainability
Description
The Environment tab button now exposes the accessible name "Environment Variables" via aria-label
but still uses title="Environment", creating inconsistent naming between the browser tooltip and
assistive tech. This mismatch is unique to the env button (Explorer/Dependencies match) and can
confuse users who rely on the tooltip.
Code

modules/playground/components/playground-sidebar.tsx[61]

+                    aria-label="Environment Variables"
Relevance

●●● Strong

Accessibility-related naming consistency is typically welcomed; aligns with repo’s prior accepted
a11y/usability improvements.

PR-#222
PR-#236

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The env button’s tooltip (title) and accessible name (aria-label) differ, while the section
header uses the aria-label wording, demonstrating the inconsistency introduced in this PR.

modules/playground/components/playground-sidebar.tsx[57-64]
modules/playground/components/playground-sidebar.tsx[69-74]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The Environment activity bar button has `title="Environment"` but `aria-label="Environment Variables"`, so the tooltip name differs from the accessible name.

### Issue Context
Explorer and Dependencies buttons have matching `title`/`aria-label`, and the sidebar section heading also uses "Environment Variables", so the tooltip is the inconsistent element.

### Fix Focus Areas
- modules/playground/components/playground-sidebar.tsx[57-64]
- modules/playground/components/playground-sidebar.tsx[69-74]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

onClick={() => setActiveTab("env")}
className={`p-2 rounded-lg transition-colors ${activeTab === "env" ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground"}`}
title="Environment"
aria-label="Environment Variables"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

1. Tooltip/label mismatch 🐞 Bug ⚙ Maintainability

The Environment tab button now exposes the accessible name "Environment Variables" via aria-label
but still uses title="Environment", creating inconsistent naming between the browser tooltip and
assistive tech. This mismatch is unique to the env button (Explorer/Dependencies match) and can
confuse users who rely on the tooltip.
Agent Prompt
### Issue description
The Environment activity bar button has `title="Environment"` but `aria-label="Environment Variables"`, so the tooltip name differs from the accessible name.

### Issue Context
Explorer and Dependencies buttons have matching `title`/`aria-label`, and the sidebar section heading also uses "Environment Variables", so the tooltip is the inconsistent element.

### Fix Focus Areas
- modules/playground/components/playground-sidebar.tsx[57-64]
- modules/playground/components/playground-sidebar.tsx[69-74]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accessibility] Add aria-label to all icon-only buttons in playground toolbar

2 participants