-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[circularprogress][linearprogress] Improve accessibility #48172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
silviuaavram
merged 46 commits into
mui:master
from
silviuaavram:feat/progress-accessibility
Apr 15, 2026
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
aeca3d7
[circularprogress][linearprogress] Improve accessibility
silviuaavram c1b867a
add linear query
silviuaavram b18110c
also add visible label to linear
silviuaavram 0dafb88
update proptypes
silviuaavram c375981
linear with aria-valuetext
silviuaavram ad8c0f5
docs add example
silviuaavram c961d52
prettier
silviuaavram 96cf60a
circular progress add props
silviuaavram bed4f27
add circular with different scale
silviuaavram dfa71f5
pnpm docs:typescript:formatted
silviuaavram 3bcc3ee
no need for proptypes in ts demo
silviuaavram 45067ed
align examples
silviuaavram 02a318a
update docs
silviuaavram 19d21ff
improve description
silviuaavram 935f827
correct grammar
silviuaavram 3fb4f2f
docs typecript formatted
silviuaavram 2aef008
code review integration
silviuaavram c3f70d2
docs changes
silviuaavram 2fe3dd8
remove default
silviuaavram a7fc26e
fix prop names
silviuaavram d109422
improve circularprogress test
silviuaavram 89cde5e
guard against division by 0
silviuaavram 2c8acdd
warn when providing min/max with incorrect variant
silviuaavram a3d921a
improve demos
silviuaavram 3cbd166
update values in docs
silviuaavram cc5a819
provide better examples in docs
silviuaavram 8135b48
prettier
silviuaavram 78b6482
docs:typescript:formatted
silviuaavram 281d338
accept both values in test
silviuaavram 7ed9b3e
only warn when min or max are provided with wrong variant
silviuaavram 165ac99
regex for dashoffset too
silviuaavram 656d608
fix error messages
silviuaavram ab46e75
remove not needed margin
silviuaavram eed6fbe
fix the value default with min
silviuaavram 5704bb0
remove rounding of value
silviuaavram 6a1b88f
fix lint
silviuaavram 8e97de0
update jsdoc
silviuaavram 4f637da
fix again jsdoc
silviuaavram 843ead2
fix jsdoc in examples
silviuaavram 2e29524
update docs
silviuaavram b36a42d
updates for docs page
silviuaavram 1933116
add MUI error prefix
silviuaavram 6972aba
safer fallbacks for min > max
silviuaavram c19fc27
fix the other test
silviuaavram 5f8524a
fix jsdoc min reference
silviuaavram f93b11f
docs:api
silviuaavram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
docs/data/material/components/progress/CircularCustomScale.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as React from 'react'; | ||
| import CircularProgress from '@mui/material/CircularProgress'; | ||
|
|
||
| export default function CircularCustomScale() { | ||
| const [progress, setProgress] = React.useState(10); | ||
|
|
||
| React.useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setProgress((prevProgress) => (prevProgress >= 20 ? 10 : prevProgress + 2)); | ||
| }, 800); | ||
|
|
||
| return () => { | ||
| clearInterval(timer); | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <CircularProgress | ||
| variant="determinate" | ||
| min={10} | ||
| max={20} | ||
| value={progress} | ||
| aria-label="Loading" | ||
| /> | ||
| ); | ||
| } | ||
26 changes: 26 additions & 0 deletions
26
docs/data/material/components/progress/CircularCustomScale.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as React from 'react'; | ||
| import CircularProgress from '@mui/material/CircularProgress'; | ||
|
|
||
| export default function CircularCustomScale() { | ||
| const [progress, setProgress] = React.useState(10); | ||
|
|
||
| React.useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setProgress((prevProgress) => (prevProgress >= 20 ? 10 : prevProgress + 2)); | ||
| }, 800); | ||
|
|
||
| return () => { | ||
| clearInterval(timer); | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <CircularProgress | ||
| variant="determinate" | ||
| min={10} | ||
| max={20} | ||
| value={progress} | ||
| aria-label="Loading" | ||
| /> | ||
| ); | ||
| } |
7 changes: 7 additions & 0 deletions
7
docs/data/material/components/progress/CircularCustomScale.tsx.preview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <CircularProgress | ||
| variant="determinate" | ||
| min={10} | ||
| max={20} | ||
| value={progress} | ||
| aria-label="Loading" | ||
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import Box from '@mui/material/Box'; | ||
| import LinearProgress from '@mui/material/LinearProgress'; | ||
|
|
||
| export default function LinearQuery() { | ||
| return ( | ||
| <Box sx={{ width: '100%' }}> | ||
| <LinearProgress aria-label="Loading…" variant="query" /> | ||
| </Box> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import Box from '@mui/material/Box'; | ||
| import LinearProgress from '@mui/material/LinearProgress'; | ||
|
|
||
| export default function LinearQuery() { | ||
| return ( | ||
| <Box sx={{ width: '100%' }}> | ||
| <LinearProgress aria-label="Loading…" variant="query" /> | ||
| </Box> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <LinearProgress aria-label="Loading…" variant="query" /> |
77 changes: 77 additions & 0 deletions
77
docs/data/material/components/progress/LinearWithAriaValueText.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import * as React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import LinearProgress from '@mui/material/LinearProgress'; | ||
| import Typography from '@mui/material/Typography'; | ||
| import Box from '@mui/material/Box'; | ||
|
|
||
| function LinearProgressWithLabelAndValue({ max, min, value, ...rest }) { | ||
|
siriwatknp marked this conversation as resolved.
|
||
| const progressText = `Elevator at floor ${value} out of ${max}.`; | ||
| const progressId = React.useId(); | ||
| return ( | ||
| <div> | ||
| <Typography | ||
| id={progressId} | ||
| variant="body2" | ||
| color="text.secondary" | ||
| sx={{ mr: 1 }} | ||
| > | ||
| Elevator status | ||
| </Typography> | ||
| <Box sx={{ display: 'flex', alignItems: 'center' }}> | ||
| <Box sx={{ width: '100%', mr: 1 }}> | ||
| <LinearProgress | ||
| variant="determinate" | ||
| aria-labelledby={progressId} | ||
| aria-valuetext={progressText} | ||
| min={min} | ||
| max={max} | ||
| value={value} | ||
| {...rest} | ||
| /> | ||
| </Box> | ||
| <Box sx={{ whiteSpace: 'nowrap' }}> | ||
| <Typography variant="body2" sx={{ color: 'text.secondary' }}> | ||
| {progressText} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| LinearProgressWithLabelAndValue.propTypes = { | ||
| /** | ||
| * The maximum value for the progress indicator for the determinate and buffer variants. | ||
| * @default 100 | ||
| */ | ||
| max: PropTypes.number.isRequired, | ||
| /** | ||
| * The minimum value for the progress indicator for the determinate and buffer variants. | ||
| * @default 0 | ||
| */ | ||
| min: PropTypes.number.isRequired, | ||
| /** | ||
| * The value of the progress indicator for the determinate and buffer variants. | ||
| * Value between `min` and `max`. | ||
| */ | ||
| value: PropTypes.number.isRequired, | ||
| }; | ||
|
|
||
| export default function LinearWithAriaValueText() { | ||
| const [progress, setProgress] = React.useState(1); | ||
|
|
||
| React.useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setProgress((prevProgress) => (prevProgress >= 10 ? 1 : prevProgress + 1)); | ||
| }, 800); | ||
| return () => { | ||
| clearInterval(timer); | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Box sx={{ width: '100%' }}> | ||
| <LinearProgressWithLabelAndValue value={progress} min={1} max={10} /> | ||
| </Box> | ||
| ); | ||
| } | ||
69 changes: 69 additions & 0 deletions
69
docs/data/material/components/progress/LinearWithAriaValueText.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import * as React from 'react'; | ||
| import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgress'; | ||
| import Typography from '@mui/material/Typography'; | ||
| import Box from '@mui/material/Box'; | ||
|
|
||
| type LinearProgressWithLabelAndValueProps = LinearProgressProps & { | ||
| min: number; | ||
| max: number; | ||
| value: number; | ||
| }; | ||
|
|
||
| function LinearProgressWithLabelAndValue({ | ||
| max, | ||
| min, | ||
| value, | ||
| ...rest | ||
| }: LinearProgressWithLabelAndValueProps) { | ||
| const progressText = `Elevator at floor ${value} out of ${max}.`; | ||
| const progressId = React.useId(); | ||
| return ( | ||
| <div> | ||
| <Typography | ||
| id={progressId} | ||
| variant="body2" | ||
| color="text.secondary" | ||
| sx={{ mr: 1 }} | ||
| > | ||
| Elevator status | ||
| </Typography> | ||
| <Box sx={{ display: 'flex', alignItems: 'center' }}> | ||
| <Box sx={{ width: '100%', mr: 1 }}> | ||
| <LinearProgress | ||
| variant="determinate" | ||
| aria-labelledby={progressId} | ||
| aria-valuetext={progressText} | ||
| min={min} | ||
| max={max} | ||
| value={value} | ||
| {...rest} | ||
| /> | ||
| </Box> | ||
| <Box sx={{ whiteSpace: 'nowrap' }}> | ||
| <Typography variant="body2" sx={{ color: 'text.secondary' }}> | ||
| {progressText} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default function LinearWithAriaValueText() { | ||
| const [progress, setProgress] = React.useState(1); | ||
|
|
||
| React.useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setProgress((prevProgress) => (prevProgress >= 10 ? 1 : prevProgress + 1)); | ||
| }, 800); | ||
| return () => { | ||
| clearInterval(timer); | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Box sx={{ width: '100%' }}> | ||
| <LinearProgressWithLabelAndValue value={progress} min={1} max={10} /> | ||
| </Box> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
docs/data/material/components/progress/LinearWithAriaValueText.tsx.preview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <LinearProgressWithLabelAndValue value={progress} min={1} max={10} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/data/material/components/progress/LinearWithValueLabel.tsx.preview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <LinearProgressWithLabel value={progress} /> | ||
| <LinearProgressWithLabelAndValue value={progress} /> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.