-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[LinearProgress] component not accessible to screen reader users #7054
Comments
I think we should treat the different bars a little different I didnt fully understand what other attributes or properties you're referring to or what you want to pass down to the progress div itself.. Could you give some examples? |
Good to know. Thanks. I just assumed they would be rendered since they weren't added conditionally.
This is what I've been doing for now. However, since these are logically two independent progress bars having just an
It depends on the use case. Some, for example, might want to add a label to the progress bar. Adding an
Depends on the use case. This is something we shouldn't hard code but instead let the users decide since behaviour like this can't really be generalized.
It's text indicating the status of the operation the progress bar is representing. Something that would be displayed on a progress bar if using numbers was unsuitable. |
@slavab89 Thanks for raising those points, I'm cleaning the component with that feedback.
@tuukkao That sounds like a good idea, we could expose a |
* [LinearProgress] Add ARIA role & fix bugs Closes #7054 * Fix tests * Fix size limits
Problem description
The version of
LinearProgress
innext
is not accessible to screen reader users.aria-valuenow
, while set correctly, doesn't convey all the needed semantics for the component to be treated like a progress bar. I've been working on fixing these issues. However, I'd like to go through some design decisions before making a pr.I've moved the aria attributes from the root
div
element to the 2 last innerdiv
elements. This is because in buffer mode those two elements represent two different progress bars. The attributes are set conditionally, i.e. only the upper bar is shown in determinate mode.However, there are some problems with this approach. Right now it is not possible to set any attributes to the actual progress bar, only to the container element. This is a problem when setting tabIndex or a status text in indeterminate/query mode, since this information needs to be associated with the element that has all the other aria attributes (
role
,aria-valuenow
, etc.) I could pass all the relevant attributes to the innerdiv
element, but this would not work in buffer mode where there are two different progress bars which might need to have e.g. different labels.One solution to this problem could be to expose separate props that would get passed through to the individual progress bars, but would that expose too much of the inner workings of the component? IT would also make the api needlessly complicated in anything other than buffer mode.
Another solution would be to pass all the attributes through to the
div
element that represents the progress bar and have a separate prop for the buffer bar attributes, but this approach has the downside of making the api somewhat more unpredictable. However, this design feels the most natural to me, since it enforces more complexity only when it is needed.Any thoughts?
Link to minimal working code that reproduces the issue
https://github.com/callemall/material-ui/blob/next/docs/src/pages/component-demos/progress/LinearBuffer.js
Versions
The text was updated successfully, but these errors were encountered: