Skip to content

[circularprogress][linearprogress] Improve accessibility#48172

Open
silviuaavram wants to merge 31 commits intomui:masterfrom
silviuaavram:feat/progress-accessibility
Open

[circularprogress][linearprogress] Improve accessibility#48172
silviuaavram wants to merge 31 commits intomui:masterfrom
silviuaavram:feat/progress-accessibility

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented Apr 1, 2026

Closes #48179

LinearProgress

  • add min and max props
  • add non-production checks for when value and bufferValue is not between the min and max values
  • add non-production checks for passing min and max with indeterminate / query variants
  • safeguard against calculating style when min >= max
  • change label docs example to include both label and value label
  • add docs example to illustrate aria-valuetext
  • docs example for missing query variant.

CircularProgress

  • add min and max props
  • non-production check for value when not in bounds
  • add non-production checks for passing min and max with indeterminate / query variants
  • safeguard against calculating style when min >= max
  • docs example to illustrate custom scales (min and max usage)

@silviuaavram silviuaavram added accessibility a11y component: CircularProgress The React component. component: LinearProgress The React component. scope: progress Changes related to the progress. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Apr 1, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 1, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+157B(+0.03%) 🔺+74B(+0.05%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against ac8c332

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

Improves accessibility and flexibility of LinearProgress and CircularProgress by introducing configurable value ranges (minValue/maxValue), adding dev-time range validation, and updating documentation/examples to better demonstrate accessible labeling patterns.

Changes:

  • Add minValue/maxValue props to Linear/Circular progress and update determinate/buffer calculations to use the custom range.
  • Add/extend tests for RTL determinate behavior and custom range + dev warnings.
  • Update docs and API descriptions with new demos (custom scale, aria-valuetext, query variant) and revised labeling example.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
packages/mui-material/src/LinearProgress/LinearProgress.js Implements minValue/maxValue handling and dev warnings for LinearProgress.
packages/mui-material/src/LinearProgress/LinearProgress.d.ts Adds TS typings for minValue/maxValue.
packages/mui-material/src/LinearProgress/LinearProgress.test.js Adds RTL determinate coverage and custom range/warning tests.
packages/mui-material/src/CircularProgress/CircularProgress.js Implements minValue/maxValue handling and dev warnings for CircularProgress determinate.
packages/mui-material/src/CircularProgress/CircularProgress.d.ts Adds TS typings for minValue/maxValue.
packages/mui-material/src/CircularProgress/CircularProgress.test.js Adds custom range and warning tests for CircularProgress.
docs/translations/api-docs/linear-progress/linear-progress.json Documents new props in generated API translations.
docs/translations/api-docs/circular-progress/circular-progress.json Documents new props in generated API translations.
docs/pages/material-ui/api/linear-progress.json Adds minValue/maxValue to API page JSON.
docs/pages/material-ui/api/circular-progress.json Adds minValue/maxValue to API page JSON.
docs/data/material/components/progress/progress.md Adds new demos/sections (custom scale, query, aria-valuetext) and updates headings/text.
docs/data/material/components/progress/LinearWithValueLabel.tsx Updates the “with label” demo to use aria-labelledby + visible label and value label.
docs/data/material/components/progress/LinearWithValueLabel.js JS version of the updated “with label” demo.
docs/data/material/components/progress/LinearWithValueLabel.tsx.preview Updates preview snippet to new component name.
docs/data/material/components/progress/LinearWithAriaValueText.tsx New demo showing aria-valuetext for non-percentage scales.
docs/data/material/components/progress/LinearWithAriaValueText.js JS version of the new aria-valuetext demo.
docs/data/material/components/progress/LinearWithAriaValueText.tsx.preview Preview snippet for the new aria-valuetext demo.
docs/data/material/components/progress/LinearQuery.tsx New demo for variant="query".
docs/data/material/components/progress/LinearQuery.js JS version of the new query demo.
docs/data/material/components/progress/LinearQuery.tsx.preview Preview snippet for the new query demo.
docs/data/material/components/progress/CircularCustomScale.tsx New demo showing custom scale usage for CircularProgress.
docs/data/material/components/progress/CircularCustomScale.js JS version of the custom scale demo.
docs/data/material/components/progress/CircularCustomScale.tsx.preview Preview snippet for the custom scale demo.
docs/data/material/components/progress/CircularWithValueLabel.js Updates wording to reference minValue/maxValue.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 382 to 385
rootProps['aria-valuemin'] = minValue;
rootProps['aria-valuemax'] = maxValue;
let transform = ((value - minValue) / (maxValue - minValue)) * 100 - 100;
if (isRtl) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically a user could pass in identical max and min, causing division by 0, we could add another dev warning when min >= max, e.g. https://github.com/mui/base-ui/blob/d15bc0a4fb82f56f08c16d50cd6a4acc3c5247e5/packages/react/src/slider/root/SliderRoot.tsx#L270-L274

and then no need to handle it here

@silviuaavram silviuaavram force-pushed the feat/progress-accessibility branch from 2e8c17d to a91d06e Compare April 6, 2026 07:48
@silviuaavram silviuaavram added needs cherry-pick The PR should be cherry-picked to master after merge. v7.x labels Apr 6, 2026
Copy link
Copy Markdown
Contributor

@mapache-salvaje mapache-salvaje left a comment

Choose a reason for hiding this comment

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

Docs changes look good! 👍

Copy link
Copy Markdown
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Good accessibility improvements overall — min/max props, dev warnings, and new demos are solid additions. A few issues to address:

if (isRtl) {
transform = -transform;
}
inlineStyles.bar1.transform = `translateX(${transform}%)`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same division-by-zero issue here. If max === min, ((value - min) / (max - min))NaN. Should guard range > 0 before computing transforms, or clamp.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is fine since we already have an error for min>=max, which is obvious developer error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a guard for both this one and circular progress

circleStyle.strokeDashoffset = `${(((max - value) / (max - min)) * circumference).toFixed(3)}px`;
rootStyle.transform = 'rotate(-90deg)';

rootProps['aria-valuenow'] = Math.round(value);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: aria-valuemin and aria-valuemax are only set in the determinate branch. Per WAI-ARIA progressbar, aria-valuemin/aria-valuemax are optional when using the default 0-100 range. But when custom min/max are provided by the user for indeterminate (which is ignored here), no warning is emitted. Consider warning if min/max are provided with variant="indeterminate" since they have no effect.

@silviuaavram silviuaavram force-pushed the feat/progress-accessibility branch from dba6fe7 to fac9022 Compare April 8, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y component: CircularProgress The React component. component: LinearProgress The React component. needs cherry-pick The PR should be cherry-picked to master after merge. scope: progress Changes related to the progress. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Progress] Support minValue and maxValue

6 participants