Skip to content

🎨 Palette: Add ARIA progressbar roles to Progress component#959

Open
anchapin wants to merge 1 commit intomainfrom
palette-progress-a11y-565289702158579289
Open

🎨 Palette: Add ARIA progressbar roles to Progress component#959
anchapin wants to merge 1 commit intomainfrom
palette-progress-a11y-565289702158579289

Conversation

@anchapin
Copy link
Copy Markdown
Owner

@anchapin anchapin commented Apr 5, 2026

Added ARIA attributes to the Progress UI component to improve accessibility for screen readers.

💡 What: Added role="progressbar", aria-valuemin, aria-valuemax, and aria-valuenow attributes to the main div element of the Progress component. Also added unit tests to verify the attributes.
🎯 Why: To make the component accessible, allowing screen readers to inform users of the loading state visually represented by the progress bar.
Accessibility: The Progress component is now fully semantically correct and identifiable as a progress bar by assistive technologies.


PR created automatically by Jules for task 565289702158579289 started by @anchapin

Summary by Sourcery

Improve accessibility of the Progress UI component by exposing ARIA progressbar attributes.

New Features:

  • Expose ARIA progressbar attributes (role, aria-valuemin, aria-valuemax, aria-valuenow) on the Progress component for assistive technologies.

Tests:

  • Add unit tests to verify the Progress component renders the correct ARIA progressbar attributes.

Added `role="progressbar"` along with `aria-valuemin`, `aria-valuemax`, and `aria-valuenow` attributes to the Progress UI component to make it accessible to screen readers, reflecting the loading state visually provided by the component. Also added tests to verify the attributes are correctly applied.

Co-authored-by: anchapin <6326294+anchapin@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings April 5, 2026 23:29
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 5, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds ARIA progressbar semantics to the Progress UI component and introduces tests to verify accessibility attributes.

Class diagram for updated Progress component with ARIA attributes

classDiagram
  class ProgressProps {
    +number value
    +number max
    +string className
  }

  class Progress {
    +number value
    +number max
    +string className
    +string role
    +number ariaValuemin
    +number ariaValuemax
    +number ariaValuenow
    +render() ReactElement
  }

  ProgressProps <|.. Progress

  Progress : role = progressbar
  Progress : ariaValuemin = 0
  Progress : ariaValuemax = max
  Progress : ariaValuenow = value
Loading

File-Level Changes

Change Details Files
Make Progress component expose proper ARIA progressbar semantics for assistive technologies.
  • Add role="progressbar" to the Progress root element
  • Set aria-valuemin to a fixed lower bound of 0
  • Bind aria-valuemax to the component's max prop to represent the upper bound
  • Bind aria-valuenow to the current value prop to expose current progress
frontend/src/components/ui/progress.tsx
Introduce tests to assert ARIA attributes are rendered correctly on the Progress component.
  • Create a new test suite for the Progress component
  • Render Progress with representative props and assert role and ARIA attributes are present and correctly set
frontend/src/components/ui/progress.test.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider handling cases where value is undefined or outside the [0, max] range so that aria-valuenow is either omitted for indeterminate progress or clamped to a valid range to avoid confusing assistive technologies.
  • If the component supports custom min values conceptually, you may want to expose aria-valuemin via props instead of hardcoding 0 to keep the semantic range aligned with the logical range.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider handling cases where `value` is `undefined` or outside the `[0, max]` range so that `aria-valuenow` is either omitted for indeterminate progress or clamped to a valid range to avoid confusing assistive technologies.
- If the component supports custom min values conceptually, you may want to expose `aria-valuemin` via props instead of hardcoding `0` to keep the semantic range aligned with the logical range.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the accessibility semantics of the shared Progress UI component by adding WAI-ARIA progressbar attributes, and introduces unit tests to validate the rendered ARIA attributes.

Changes:

  • Added role="progressbar" plus aria-valuemin, aria-valuemax, and aria-valuenow to the Progress component root element.
  • Added Vitest/Testing Library unit tests to assert the ARIA attributes for default and custom values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
frontend/src/components/ui/progress.tsx Adds progressbar role and ARIA value attributes to improve screen reader support.
frontend/src/components/ui/progress.test.tsx Adds unit tests verifying the new ARIA attributes are present and correct.

Comment on lines +18 to 22
role="progressbar"
aria-valuemin={0}
aria-valuemax={max}
aria-valuenow={value}
className={`relative w-full overflow-hidden rounded-full bg-gray-200 ${className}`}
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

aria-valuenow is set to the raw value, but the visual fill is clamped to 0–100% via percentage. If callers pass value < 0 or value > max, the UI will clamp while the ARIA attributes can become invalid/inconsistent (e.g., aria-valuenow > aria-valuemax). Consider clamping value into [0, max] (and using that clamped value for both percentage and aria-valuenow).

Copilot uses AI. Check for mistakes.
const progressbar = screen.getByRole('progressbar');
expect(progressbar).toHaveAttribute('aria-valuenow', '50');
expect(progressbar).toHaveAttribute('aria-valuemax', '200');
});
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

The new tests assert the presence of ARIA attributes for default/custom cases, but they don't cover the out-of-range scenarios where the component currently clamps the visual fill. Adding tests for value > max and value < 0 would prevent regressions and ensure ARIA values stay consistent with the rendered progress.

Suggested change
});
});
it('clamps aria-valuenow to max when value exceeds max', () => {
render(<Progress value={150} max={100} />);
const progressbar = screen.getByRole('progressbar');
expect(progressbar).toHaveAttribute('aria-valuenow', '100');
expect(progressbar).toHaveAttribute('aria-valuemax', '100');
});
it('clamps aria-valuenow to the minimum when value is below zero', () => {
render(<Progress value={-10} max={100} />);
const progressbar = screen.getByRole('progressbar');
expect(progressbar).toHaveAttribute('aria-valuenow', '0');
expect(progressbar).toHaveAttribute('aria-valuemin', '0');
});

Copilot uses AI. Check for mistakes.
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