Skip to content

[circularprogress][linearprogress] Improve accessibility#48172

Merged
silviuaavram merged 46 commits intomui:masterfrom
silviuaavram:feat/progress-accessibility
Apr 15, 2026
Merged

[circularprogress][linearprogress] Improve accessibility#48172
silviuaavram merged 46 commits intomui:masterfrom
silviuaavram:feat/progress-accessibility

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented Apr 1, 2026

Closes #48179.
Closes #39072.

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, show 0 progress visually
  • 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, show empty circle visually
  • 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 🔺+136B(+0.03%) 🔺+71B(+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 73fd6d6

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 thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js
Comment thread docs/data/material/components/progress/progress.md Outdated
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
Comment thread docs/translations/api-docs/linear-progress/linear-progress.json Outdated
Comment thread docs/translations/api-docs/circular-progress/circular-progress.json Outdated
Comment thread docs/data/material/components/progress/progress.md Outdated
Comment thread docs/data/material/components/progress/LinearWithAriaValueText.tsx Outdated
Comment thread docs/data/material/components/progress/LinearWithAriaValueText.js Outdated
Comment thread packages/mui-material/src/LinearProgress/LinearProgress.js Outdated
Comment thread packages/mui-material/src/LinearProgress/LinearProgress.js Outdated
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

Comment thread docs/data/material/components/progress/LinearWithValueLabel.tsx Outdated
Comment thread packages/mui-material/src/LinearProgress/LinearProgress.d.ts Outdated
Comment thread docs/data/material/components/progress/progress.md Outdated
@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! 👍

Comment thread docs/data/material/components/progress/progress.md Outdated
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.test.js
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:

Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.test.js
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

Comment thread packages/mui-material/src/LinearProgress/LinearProgress.js
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.

Comment thread docs/data/material/components/progress/LinearWithAriaValueText.js
Comment thread docs/data/material/components/progress/CircularCustomScale.js
@silviuaavram silviuaavram force-pushed the feat/progress-accessibility branch from dba6fe7 to fac9022 Compare April 8, 2026 12:34
Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
Comment thread packages/mui-material/src/LinearProgress/LinearProgress.js Outdated
Comment thread docs/data/material/components/progress/LinearWithValueLabel.tsx Outdated
inlineStyles.bar1.transform = `translateX(${transform}%)`;
inlineStyles.bar1.transform = range > 0 ? `translateX(${transform}%)` : undefined;

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.

Suggested change
rootProps['aria-valuenow'] = Math.round(value);
rootProps['aria-valuenow'] = value;

Shouldn't round this or it will break when min={0} max={1} value={0.25}

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.

It was like this before my changes, but the comment is relevant. Will change for both!

Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
@silviuaavram silviuaavram force-pushed the feat/progress-accessibility branch from ac8c332 to 4a3d781 Compare April 14, 2026 11:23
@silviuaavram silviuaavram force-pushed the feat/progress-accessibility branch from 73fd6d6 to 6a1b88f Compare April 14, 2026 11:59
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard bot commented Apr 14, 2026

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+180B(+0.04%) 🔺+79B(+0.05%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 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

Deploy preview


Check out the code infra dashboard for more information about this PR.

@mj12albert
Copy link
Copy Markdown
Member

Might be worth adding just a bit more docs and close this issue out as well: #39072

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.

Adversarial review flagged a few concerns around the new range support. Details inline.

transform = -transform;
}
inlineStyles.bar2.transform = `translateX(${transform}%)`;
inlineStyles.bar2.transform = range > 0 ? `translateX(${transform}%)` : undefined;
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.

[high] Fails open on invalid range.

When min >= max, the inline transform is set to undefined, but the base bar styling renders both bars at full width — so production builds display a completed bar for invalid input. That turns bad backend/config data into a user-visible false-success state, which is the exact class of bug these props should surface.

Recommendation: fail closed instead of open. Either clamp to an empty state (translateX(-100%) / equivalent), or skip rendering the determinate fill entirely when the range is invalid, while still logging the validation error in development.

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.

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 the translateX(-100%) fallback when min > max

Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js
Comment thread packages/mui-material/src/LinearProgress/LinearProgress.test.js Outdated
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.

Thanks for the fixes — fail-closed behavior and error prefix look good. One minor doc nit from re-review.

Comment thread packages/mui-material/src/CircularProgress/CircularProgress.js Outdated
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

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


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

Comment thread packages/mui-material/src/LinearProgress/LinearProgress.test.js
Comment on lines +252 to +256
it('should warn if the value is out of range', () => {
expect(() => {
render(<LinearProgress variant="determinate" value={-1} min={0} max={10} />);
}).toErrorDev([
'MUI: The min, max, and value props in LinearProgress should be numbers where min < max and min <= value <= max. Received min=0, max=10, value=-1.',
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

Test name says "should warn" but the assertion expects console.error via toErrorDev. Rename the test (or change the expectation) so the wording matches the actual behavior being verified.

Copilot uses AI. Check for mistakes.
Comment thread docs/pages/material-ui/api/circular-progress.json
@silviuaavram silviuaavram removed v7.x needs cherry-pick The PR should be cherry-picked to master after merge. labels Apr 15, 2026
@silviuaavram silviuaavram merged commit 529b113 into mui:master Apr 15, 2026
25 checks passed
@silviuaavram silviuaavram deleted the feat/progress-accessibility branch April 15, 2026 10:29
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. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Progress] Support minValue and maxValue [docs][material-ui] Add explanations for the Progress page circular demos

6 participants